Serial rendering system with auto-synchronization on frame blanking

ABSTRACT

A device and method for providing a frame buffer interface to a serial rendering system which automatically synchronizes with data in the rendering path before blanking the active frame. To prevent rewriting to a frame buffer of rendered data before the current rendered data can be displayed, the disclosed embodiment provides that when the data is ready to be displayed, all further writes to the buffer are suspended, while all other accesses throughout the system are allowed to proceed. When the vblank command is received, data is passed to the display system for display, and writes to that buffer are re-enabled. When writes to a specific buffer portion are suspended, all other processes may continue independently.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation-in-part of 08/410,345 filed Mar. 24,1995, and claims priority from provisional 60/008,803 filed Dec. 18,1995, which is hereby incorporated by reference.

BACKGROUND AND SUMMARY OF THE INVENTION

The present application relates to computer graphics and animationsystems, and particularly to 3D graphics rendering hardware. Backgroundof the art and the prior embodiment, according to the parentapplication, is described below. Some of the distinctions of thepresently preferred embodiment are particularly noted beginning on page1.

Computer Graphics and Rendering

Modern computer systems normally manipulate graphical objects ashigh-level entities. For example, a solid body may be described as acollection of triangles with specified vertices, or a straight linesegment may be described by listing its two endpoints withthree-dimensional or two-dimensional coordinates. Such high-leveldescriptions are a necessary basis for high-level geometricmanipulations, and also have the advantage of providing a compact formatwhich does not consume memory space unnecessarily.

Such higher-level representations are very convenient for performing themany required computations. For example, ray-tracing or other lightingcalculations may be performed, and a projective transformation can beused to reduce a three-dimensional scene to its two-dimensionalappearance from a given viewpoint. However, when an image containinggraphical objects is to be displayed, a very low-level description isneeded. For example, in a conventional CRT display, a "flying spot" ismoved across the screen (one line at a time), and the beam from each ofthree electron guns is switched to a desired level of intensity as theflying spot passes each pixel location. Thus at some point the imagemodel must be translated into a data set which can be used by aconventional display. This operation is known as "rendering."

The graphics-processing system typically interfaces to the displaycontroller through a "frame store" or "frame buffer" of special two-portmemory, which can be written to randomly by the graphics processingsystem, but also provides the synchronous data output needed by thevideo output driver. (Digital-to-analog conversion is also providedafter the frame buffer.) Such a frame buffer is usually implementedusing VRAM memory chips (or sometimes with DRAM and special DRAMcontrollers). This interface relieves the graphics-processing system ofmost of the burden of synchronization for video output. Nevertheless,the amounts of data which must be moved around are very sizable, and thecomputational and data-transfer burden of placing the correct data intothe frame buffer can still be very large.

Even if the computational operations required are quite simple, theymust be performed repeatedly on a large number of datapoints. Forexample, in a typical 1995 high-end configuration, a display of1280×1024 elements may need to be refreshed at 72 Hz, with a colorresolution of 24 bits per pixel. If blending is desired, additional bits(e.g. another 8 bits per pixel) will be required to store an "alpha" ortransparency value for each pixel. This implies manipulation of morethan 3 billion bits per second, without allowing for any of the actualcomputations being performed. Thus it may be seen that this is anenvironment with unique data manipulation requirements.

If the display is unchanging, no demand is placed on the renderingoperations. However, some common operations (such as zooming orrotation) will require every object in the image space to bere-rendered. Slow rendering will make the rotation or zoom appear jerky.This is highly undesirable. Thus efficient rendering is an essentialstep in translating an image representation into the correct pixelvalues. This is particularly true in animation applications, where newlyrendered updates to a computer graphics display must be generated atregular intervals.

The rendering requirements of three-dimensional graphics areparticularly heavy. One reason for this is that, even after thethree-dimensional model has been translated to a two-dimensional model,some computational tasks may be bequeathed to the rendering process.(For example, color values will need to be interpolated across atriangle or other primitive.) These computational tasks tend to burdenthe rendering process. Another reason is that since three-dimensionalgraphics are much more lifelike, users are more likely to demand a fullyrendered image. (By contrast, in the two-dimensional images created e.g.by a GUI or simple game, users will learn not to expect all areas of thescene to be active or filled with information.)

FIG. 1A is a very high-level view of other processes performed in a 3Dgraphics computer system. A three dimensional image which is defined insome fixed 3D coordinate system (a "world" coordinate system) istransformed into a viewing volume (determined by a view position anddirection), and the parts of the image which fall outside the viewingvolume are discarded. The visible portion of the image volume is thenprojected onto a viewing plane, in accordance with the familiar rules ofperspective. This produces a two-dimensional image, which is now mappedinto device coordinates. It is important to understand that all of theseoperations occur prior to the operations performed by the renderingsubsystem of the present invention. FIG. 1B is an expanded version ofFIG. 1A, and shows the flow of operations defined by the OpenGLstandard.

A vast amount of engineering effort has been invested in computergraphics systems, and this area is one of increasing activity anddemands. Numerous books have discussed the requirements of this area;see, e.g., ADVANCES IN COMPUTER GRAPHICS (ed. Enderle 1990-); Chellappaand Sawchuk, DIGITAL IMAGE PROCESSING AND ANALYSIS (1985); COMPUTERGRAPHICS HARDWARE (ed. Reghbati and Lee 1988); COMPUTER GRAPHICS: IMAGESYNTHESIS (ed. Joy et al.); Foley et al., FUNDAMENTALS OF INTERACTIVECOMPUTER GRAPHICS (2.ed. 1984); Foley, COMPUTER GRAPHICS PRINCIPLES &PRACTICE (2.ed. 1990); Foley, INTRODUCTION TO COMPUTER GRAPHICS (1994);Giloi, Interactive Computer Graphics (1978); Hearn and Baker, COMPUTERGRAPHICS (2.ed. 1994); Hill, COMPUTER GRAPHICS (1990); Latham,DICTIONARY OF COMPUTER GRAPHICS (1991); Magnenat-Thalma, IMAGE SYNTHESISTHEORY & PRACTICE (1988); Newman and Sproull, PRINCIPLES OF INTERACTIVECOMPUTER GRAPHICS (2.ed. 1979); PICTURE ENGINEERING (ed. Fu and Kunii1982); PICTURE PROCESSING & DIGITAL FILTERING (2.ed. Huang 1979);Prosise, How COMPUTER GRAPHICS WORK (1994); Rimmer, BIT MAPPED GRAPHICS(2.ed. 1993); Salmon, COMPUTER GRAPHICS SYSTEMS & CONCEPTS (1987);Schachter, COMPUTER IMAGE GENERATION (1990); Watt, THREE-DIMENSIONALCOMPUTER GRAPHICS (2.ed. 1994); Scott Whitman, MULTIPROCESSOR METHODSFOR COMPUTER GRAPHICS RENDERING; the SIGGRAPH PROCEEDINGS for the years1980-1994; and the IEEE Computer Graphics and Applications magazine forthe years 1990-1994; all of which are hereby incorporated by reference.

Background: Graphics Animation

In many areas of computer graphics a succession of slowly changingpictures are displayed rapidly one after the other, to give theimpression of smooth movement, in much the same way as for cartoonanimation. In general the higher the speed of the animation, thesmoother (and better) the result.

When an application is generating animation images, it is normallynecessary not only to draw each picture into the frame buffer, but alsoto first clear down the frame buffer, and to clear down auxiliarybuffers such as depth (Z) buffers, stencil buffers, alpha buffers andothers. A good treatment of the general principles may be found inComputer Graphics: Principles and Practice, James D. Foley et al.,Reading MA: Addison-Wesley. A specific description of the variousauxiliary buffers may be found in The OpenGL Graphics System: ASpecification (Version 1.0), Mark Segal and Kurt Akeley, SGI.

In most applications the value written, when clearing any given buffer,is the same at every pixel location, though different values may be usedin different auxiliary buffers. Thus the frame buffer is often clearedto the value which corresponds to black, while the depth (Z) buffer istypically cleared to a value corresponding to infinity.

The time taken to clear down the buffers is often a significant portionof the total time taken to draw a frame, so it is important to minimizeit.

Background: Parallelism in Graphics Processing

Due to the large number of at least partially independent operationswhich are performed in rendering, many proposals have been made to usesome form of parallel architecture for graphics (and particularly forrendering). See, for example, the special issue of Computer Graphics onparallel rendering (September 1994). Other approaches may be found inearlier patent filings by the assignee of the present application andits predecessors, e.g. U.S. Pat. No. 5,195,186, and published PCTapplications PCT/GB90/00987, PCT/GB90/01209, PCT/GB90/01210,PCT/GB90/01212, PCT/GB90/01213, PCT/GB90/01214, PCT/GB90/01215, andPCT/GB90/01216, all of which are hereby incorporated by reference.

Background: Pipelined Processing Generally

There are several general approaches to parallel processing. One of thebasic approaches to achieving parallelism in computer processing is atechnique known as pipelining. In this technique the individualprocessors are, in effect, connected in series in an assembly-lineconfiguration: one processor performs a first set of operations on onechunk of data, and then passes that chunk along to another processorwhich performs a second set of operations, while at the same time thefirst processor performs the first set operations again on another chunkof data. Such architectures are generally discussed in Kogge, THEARCHITECTURE OF PIPELINED COMPUTERS (1981), which is hereby incorporatedby reference.

Background: The OpenGL™ Standard

The "OpenGL" standard is a very important software standard for graphicsapplications. In any computer system which supports this standard, theoperating system(s) and application software programs can make callsaccording to the OpenGL standards, without knowing exactly what thehardware configuration of the system is.

The OpenGL standard provides a complete library of low-level graphicsmanipulation commands, which can be used to implement three-dimensionalgraphics operations. This standard was originally based on theproprietary standards of Silicon Graphics, Inc., but was latertransformed into an open standard. It is now becoming extremelyimportant, not only in high-end graphics-intensive workstations, butalso in high-end PCs. OpenGL is supported by Windows NT™, which makes itaccessible to many PC applications.

The OpenGL specification provides some constraints on the sequence ofoperations. For instance, the color DDA operations must be performedbefore the texturing operations, which must be performed before thealpha operations. (A "DDA" or digital differential analyzer, is aconventional piece of hardware used to produce linear gradation of color(or other) values over an image area.)

Other graphics interfaces (or "APIs"), such as PHIGS or XGL, are alsocurrent as of 1995; but at the lowest level, OpenGL is a superset ofmost of these.

The OpenGL standard is described in the OPENGL PROGRAMMING GUIDE (1993),the OPENGL REFERENCE MANUAL (1993), and a book by Segal and Akeley (ofSGI) entitled THE OPENGL GRAPHICS SYSTEM: A SPECIFICATION (Version 1.0),all of which are hereby incorporated by reference.

FIG. 1B is an expanded version of FIG. 1A, and shows the flow ofoperations defined by the OpenGL standard. Note that the most basicmodel is carried in terms of vertices, and these vertices are thenassembled into primitives (such as triangles, lines, etc.). After allmanipulation of the primitives has been completed, the renderingoperations will translate each primitive into a set of "fragments." (Afragment is the portion of a primitive which affects a single pixel.)Again, it should be noted that all operations above the block marked"Rasterization" would be performed by a host processor, or possibly by a"geometry engine" (i.e. a dedicated processor which performs rapidmatrix multiplies and related data manipulations), but would normallynot be performed by a dedicated rendering processor such as that of thepresently preferred embodiment.

Innovative System and Preferred System Context

The presently preferred embodiments improve upon past rendering systemsby disclosing a device and method for providing a frame buffer interfaceto a serial rendering system which automatically synchronizes with datain the rendering path before blanking the active frame. To preventrewriting to a frame buffer of rendered data before the current rendereddata can be displayed, the disclosed embodiment provides that when thedata is ready to be displayed, all further accesses to the frame bufferby the rendering system are suspended, while all other memory orprocessing operations throughout the system are allowed to proceed. Whenthe video timing generator indicates that the vertical blanking periodis starting, accesses to the frame buffer by the rendering system areresumed. When accesses to a specific buffer portion are suspended, allother processes may continue independently.

One embodiment provides a pipelined graphics system comprising thedisclosed framebuffer interface. In this embodiment, because of theserial nature of the system, when the frame buffer access is suspended,data to be written backs up throughout the data path. Therefore,although no other process is specifically suspended, a "ripple" effectis caused as unprocessed data backs up and forces each process to haltuntil the data can be processed. When the display system has finisheddisplaying the current screen, a resume command is sent to theframebuffer, and the display system automatically starts using pixeldata from the alternate framebuffer for display. As the framebufferresumes processing the stalled data, the backed-up data throughout thesystem is automatically processed.

BRIEF DESCRIPTION OF THE DRAWING

The disclosed inventions will be described with reference to theaccompanying drawings, which show important sample embodiments of theinvention and which are incorporated in the specification hereof byreference, wherein:

FIG. 1A, described above, is an overview of key elements and processesin a 3D graphics computer system.

FIG. 1B is an expanded version of FIG. 1A, and shows the flow ofoperations defined by the OpenGL standard.

FIG. 2A is an overview of the graphics rendering chip of the preferredembodiment of the parent case.

FIG. 2B is an overview of the graphics rendering chip of the presentlypreferred embodiment.

FIG. 2C is a more schematic view of the sequence of operations performedin the graphics rendering chip of FIG. 2B, when operating in a firstmode.

FIG. 2D is a different view of the graphics rendering chip of FIG. 2B,showing the connections of a readback bus which provides a diagnosticpathway.

FIG. 2E is yet another view of the graphics rendering chip of FIG. 2B,showing how the functions of the core pipeline of FIG. 2C are combinedwith various external interface functions.

FIG. 2F is yet another view of the graphics rendering chip of FIG. 2B,showing how the details of FIFO depth and lookahead are implemented, inthe presently preferred embodiment.

FIG. 3A shows a sample graphics board which incorporates the chip ofFIG. 2B.

FIG. 3B shows another sample graphics board implementation, whichdiffers from the board of FIG. 3A in that more memory and an additionalcomponent is used to achieve higher performance.

FIG. 3C shows another graphics board, in which the chip of FIG. 2Bshares access to a common frame store with GUI accelerator chip.

FIG. 3D shows another graphics board, in which the chip of FIG. 2Bshares access to a common frame store with a video coprocessor (whichmay be used for video capture and playback functions.

FIG. 4A illustrates the definition of the dominant side and thesubordinate sides of a triangle.

FIG. 4B illustrates the sequence of rendering an Antialiased Lineprimitive.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The numerous innovative teachings of the present application will bedescribed with particular reference to the presently preferredembodiment (by way of example, and not of limitation). The presentlypreferred embodiment is a GLINT™ 400TX™ 3D rendering chip. The HardwareReference Manual and Programmer's Reference Manual for this chipdescribe further details of this sample embodiment, and are both herebyincorporated by reference. Both are available, as of the effectivefiling date of this application, from 3Dlabs Inc. Ltd., 181 Metro Drive,Suite 520, San Jose Calif. 95110.

Definitions

The following definitions may help in understanding the exact meaning ofterms used in the text of this application:

application:

a computer program which uses graphics animation.

depth (Z) buffer:

A memory buffer containing the depth component of a pixel. Used to, forexample, eliminate hidden surfaces.

blt double-buffering:

A technique for achieving smooth animation, by rendering only to anundisplayed back buffer, and then copying the back buffer to the frontonce drawing is complete.

FrameCount Planes:

Used to allow higher animation rates by enabling DRAM local buffer pixeldata, such as depth (Z), to be cleared down quickly.

frame buffer:

An area of memory containing the displayable color buffers (front, back,left, right, overlay, underlay). This memory is typically separate fromthe local buffer.

local buffer:

An area of memory which may be used to store nondisplayable pixelinformation: depth(Z), stencil, FrameCount and GID planes. This memoryis typically separate from the

framebuffer.

pixel:

Picture element. A pixel comprises the bits in all the buffers (whetherstored in the local buffer or framebuffer), corresponding to aparticular location in the framebuffer.

stencil buffer:

A buffer used to store information about a pixel which controls howsubsequent stencilled pixels at the same location may be combined withthe current value in the framebuffer. Typically used to mask complextwo-dimensional shapes.

Preferred Chip Embodiment--Overview

The GLINT™ high performance graphics processors combine workstationclass 3D graphics acceleration, and state-of-the-art 2D performance in asingle chip. All 3D rendering operations are accelerated by GLINT,including Gouraud shading, texture mapping, depth buffering,anti-aliasing, and alpha blending.

The scalable memory architecture of GLINT makes it ideal for a widerange of graphics products, from PC boards to high-end workstationaccelerators.

There will be several of the GLINT family of graphics processors: theGLINT 300SX™ is the preferred embodiment of the parent application, andthe GLINT 400TX™ is the presently preferred embodiment which isdescribed herein in great detail. The two devices are generallycompatible, with the 400TX adding local texture storage and texeladdress generation for all texture modes.

FIG. 2B is an overview of the graphics rendering chip of the presentlypreferred embodiment (i.e. the GLINT 400TX™).

General Concept

The overall architecture of the GLINT chip is best viewed using thesoftware paradigm of a message passing system. In this system all theprocessing blocks are connected in a long pipeline with communicationwith the adjacent blocks being done through message passing. Betweeneach block there is a small amount of buffering, the size being specificto the local communications requirements and speed of the two blocks.

The message rate is variable and depends on the rendering mode. Themessages do not propagate through the system at a fixed rate typical ofa more traditional pipeline system. If the receiving block can notaccept a message, because its input buffer is full, then the sendingblock stalls until space is available.

The message structure is fundamental to the whole system as the messagesare used to control, synchronize and inform each block about theprocessing it is to undertake. Each message has two fields--a 32 bitdata field and a 9 bit tag field. (This is the minimum width guaranteed,but some local block to block connections may be wider to accommodatemore data.) The data field will hold color informarion, coordinateinformation, local state information, etc. The tag field is used by eachblock to identify the message type so it knows how to act on it.

Each block, on receiving a message, can do one of several things:

Not recognize the message so it just passes it on to the next block.

Recognize it as updating some local state (to the block) so the localstate is updated and the message terminated, i.e. not passed on to thenext block.

Recognize it as a processing action, and if appropriate to the unit, theprocessing work specific to the unit is done. This may entail sendingout new messages such as Color and/or modifying the initial messagebefore sending it on. Any new messages are injected into the messagestream before the initial message is forwarded on. Some examples willclarify this.

When the Depth Block receives a message `new fragment`, it willcalculate the corresponding depth and do the depth test. If the testpasses then the `new fragment` message is passed to the next unit. Ifthe test fails then the message is modified and passed on. Thetemptation is not to pass the message on when the test fails (becausethe pixel is not going to be updated), but other units downstream needto keep their local DDA units in step.

(In the present application, the messages are being described in generalterms so as not to be bogged down in detail at this stage. The detailsof what a `new fragment` message actually specifies (i.e. coordinate,color information) is left till later. In general, the term "pixel" isused to describe the picture element on the screen or in memory. Theterm "fragment" is used to describe the part of a polygon or otherprimitive which projects onto a pixel. Note that a fragment may onlycover a part of a pixel.)

When the Texture Read Unit (if enabled) gets a `new fragment` message,it will calculate the texture map addresses, and will accordinglyprovide 1, 2, 4 or 8 texels to the next unit together with theappropriate number of interpolation coefficients.

Each unit and the message passing are conceptually running asynchronousto all the others. However, in the presently preferred embodiment thereis considerable synchrony because of the common clock.

How does the host process send messages? The message data field is the32 bit data written by the host, and the message tag is the bottom 9bits of the address (excluding the byte resolution address lines).Writing to a specific address causes the message type associated withthat address to be inserted into the message queue. Alternatively, theon-chip DMA controller may fetch the messages from the host's memory.

The message throughput, in the presently preferred embodiment, is 50Mmessages per second and this gives a fragment throughput of up to 50Mper second, depending on what is being rendered. Of course, this ratewill predictably be further increased over time, with advances inprocess technology and clock rates.

Linkage

The block diagram of FIG. 2A shows how the units are connected togetherin the GLINT 300SX embodiment, and the block diagram of FIG. 2B showshow the units are connected together in the presently preferred GLINT400TX embodiment. Some general points are:

The following functionality is present in the 400TX, but missing fromthe 300SX: The Texture Address (TAddr) and Texture Read (TRd) Units aremissing. Also, the router and multiplexer are missing from this section,so the unit ordering is Scissor/Stipple, Color DDA, Texture Fog Color,Alpha Test, LB Rd, etc.

In the embodiment of FIG. 2B, the order of the units can be configuredin two ways. The most general order (Router, Color DDA, Texture Unit,Alpha Test, LB Rd, GID/Z/Stencil, LB Wr, Multiplexer) and will work inall modes of OpenGL. However, when the alpha test is disabled it is muchbetter to do the Graphics ID, depth and stencil tests before the textureoperations rather than after. This is because the texture operationshave a high processing cost and this should not be spent on fragmentswhich are later rejected because of window, depth or stencil tests.

The loop back to the host at the bottom provides a simplesynchronization mechanism. The host can insert a Sync command and whenall the preceding rendering has finished the sync command will reach thebottom host interface which will notify the host the sync event hasoccurred.

Benefits

The very modular nature of this architecture gives great benefits. Eachunit lives in isolation from all the others and has a very well definedset of input and output messages. This allows the internal structure ofa unit (or group of units) to be changed to make algorithmic/speed/gatecount trade-offs.

The isolation and well defined logical and behavioral interface to eachunit allows much better testing and verification of the correctness of aunit.

The message passing paradigm is easy to simulate with software, and thehardware design is nicely partitioned. The architecture is selfsynchronizing for mode or primitive changes.

The host can mimic any block in the chain by inserting messages whichthat block would normally generate. These message would pass through theearlier blocks to the mimicked block unchanged and from then onwards tothe rest of the blocks which cannot tell the message did not originatefrom the expected block. This allows for an easy work around mechanismto correct any flaws in the chip. It also allows other rasterizationparadigms to be implemented outside of the chip, while still using thechip for the low level pixel operations.

"A Day in the Life of a Triangle"

Before we get too detailed in what each unit does it is worth whilelooking in general terms at how a primitive (e.g. triangle) passesthrough the pipeline, what messages are generated, and what happens ineach unit. Some simplifications have been made in the description toavoid detail which would otherwise complicate what is really a verysimple process. The primitive we are going to look at is the familiarGouraud shaded Z buffered triangle, with dithering. It is assumed anyother state (i.e. depth compare mode) has been set up, but (forsimplicity) such other states will be mentioned as they become relevant.

The application generates the triangle vertex information and makes thenecessary OpenGL calls to draw it.

®The OpenGL server/library gets the vertex information, transforms,clips and lights it. It calculates the initial values and derivativesfor the values to interpolate (X_(left), X_(right), red, green, blue anddepth) for unit change in dx and dxdy_(left). All these values are infixed point integer and have unique message tags. Some of the values(the depth derivatives) have more than 32 bits to cope with the dynamicrange and resolution so are sent in two halves Finally, once thederivatives, staff and end values have been sent to GLINT the `rendertriangle` message is sent.

On GLINT: The derivative, start and end parameter messages are receivedand filter down the message stream to the appropriate blocks. The depthparameters and derivatives to the Depth Unit; the RGB parameters andderivative to the Color DDA Unit; the edge values and derivatives to theRasterizer Unit.

The `render triangle` message is received by the rasterizer unit and allsubsequent messages (from the host) are blocked until the triangle hasbeen rasterized (but not necessarily written to the frame store). A`prepare to render` message is passed on so any other blocks can preparethemselves.

The Rasterizer Unit walks the left and right edges of the triangle andfills in the spans between. As the walk progresses messages are send toindicate the direction of the next step: StepX or StepYDomEdge. The datafield holds the current (x, y) coordinate. One message is sent per pixelwithin the triangle boundary. The step messages are duplicated into twogroups: an active group and a passive group. The messages always startoff in the active group but may be changed to the passive group if thispixel fails one of the tests (e.g. depth) on its path down the messagestream. The two groups are distinguished by a single bit in the messagetag. The step messages (in either form) are always passed throughout thelength of the message stream, and are used by all the DDA units to keeptheir interpolation values in step. The step message effectivelyidentifies the fragment and any other messages pertaining to thisfragment will always precede the step message in the message stream.

The Scissor and Stipple Unit. This unit does 4 tests on the fragment (asembodied by the active step message). The screen scissor test takes thecoordinates associated with the step message, converts them to be screenrelative (if necessary) and compares them against the screen boundaries.The other three tests (user scissor, line stipple and area stipple) aredisabled for this example. If the enabled tests pass then the activestep is forwarded onto the next unit, otherwise it is changed into apassive step and then forwarded.

The Color DDA unit responds to an active step message by generating aColor message and sending this onto the next unit. The active stepmessage is then forwarded to the next unit. The Color message holds, inthe data field, the current RGBA value from the DDA. If the step messageis passive then no Color message is generated. After the Color messageis sent (or would have been sent) the step message is acted on toincrement the DDA in the correct direction, ready for the next pixel.

Texturing, Fog and Alpha Tests Units are disabled so the messages justpass through these blocks.

In general terms the Local Buffer Read Unit reads the Graphic ID,Stencil and Depth information from the Local Buffer and passes it ontothe next unit. More specifically it does:

1. If the step message is passive then no further action occurs.

2. On an active step message it calculates the linear address in thelocal buffer of the required data. This is done using the (X, Y)position recorded in the step message and locally stored information onthe `screen width` and window base address. Separate read and writeaddresses are calculated.

3. The addresses are passed to the Local Buffer Interface Unit and theidentified local buffer location read. The write address is held for uselater.

4. Sometime later the local buffer data is returned and is formattedinto a consistent internal format and inserted into a `Local BufferData` message and passed on to the next unit.

The message data field is made wider to accommodate the maximum LocalBuffer width of 52 bits (32 depth, 8 stencil, 4 graphic ID, 8 framecount) and this extra width just extends to the Local Buffer Writeblock.

The actual data read from the local buffer can be in several formats toallow narrower width memories to be used in cost sensitive systems. Thenarrower data is formatted into a consistent internal format in thisblock.

The Graphic ID, Stencil and Depth Unit just passes the Color messagethrough and stores the LBData message until the step message arrives. Apassive step message would just pass straight through.

When the active step message is received the internal Graphic ID,stencil and depth values are compared with the ones in the LBDatamessage as specified by this unit's mode information. If the enabledtests pass then the new local buffer data is sent in the LBWriteDatamessage to the next unit and the active step message forwarded. If anyof the enabled tests fail then an LBCancelWrite message is sent followedby the equivalent passive step message. The depth DDA is stepped toupdate the local depth value.

The Local Buffer Write Unit performs any writes which are necessary. TheLBWriteData message has its data formatted into the external localbuffer format and this is posted to the Local Buffer Interface Unit tobe written into the memory (the write address is already waiting in theLocal Buffer Interface Unit). The LBWriteCancel message just informs theLocal Buffer Interface Unit that the pending write address is no longerneeded and can be discarded. The step message is just passed through.

In general terms the Framebuffer Read Unit reads the color informationfrom the framebuffer and passes it onto the next unit. More specificallyit does:

1. If the step message is passive then no further action occurs.

2. On an active step message it calculates the linear address in theframebuffer of the required data. This is done using the (X, Y) positionrecorded in the step message and locally stored information on the`screen width` and window base address. Separate read and writeaddresses are calculated.

3. The addresses are passed to the Framebuffer Interface Unit and theidentified framebuffer location read. The write address is held for uselater.

4. Sometime later the color data is returned and inserted into a `FrameBuffer Data` message and passed on to the next unit.

The actual data read from the framestore can be in several formats toallow narrower width memories to be used in cost sensitive systems. Theformatting of the data is deferred until the Alpha Blend Unit as it isthe only unit which needs to match it up with the internal formats. Inthis example no alpha blending or logical operations are taking place,so reads are disabled and hence no read address is sent to theFramebuffer Interface Unit. The Color and step messages just passthrough.

The Alpha Blend Unit is disabled so just passes the messages through.

The Dither Unit stores the Color message internally until an active stepis received. On receiving this it uses the least significant bits of the(X, Y) coordinate information to dither the contents of the Colormessage. Part of the dithering process is to convert from the internalcolor format into the format of the framebuffer. The new color isinserted into the Color message and passed on, followed by the stepmessage.

The Logical Operations are disabled so the Color message is justconverted into the FBWriteData message (just the tag changes) andforwarded on to the next unit. The step message just passes through.

The Framebuffer Write Unit performs any writes which are necessary. TheFBWriteData message has its data posted to the Framebuffer InterfaceUnit to be written into the memory (the write address is already waitingin the Framebuffer Interface Unit).

The step message is just passed through.

The Host Out Unit is mainly concerned with synchronization with

the host so for this example will just consume any messages which reachthis point in the message stream.

This description has concentrated on what happens as one fragment flowsdown the message stream. It is important to remember that at any instantin time there are many fragments flowing down the message stream and thefurther down they reach the more processing has occurred.

Interfacing Between Blocks

FIG. 2B shows the FIFO buffering and lookahead connections which areused in the presently preferred embodiment. The FIFOs are used toprovide an asynchronous interface between blocks, but are expensive interms of gate count. Note that most of these FIFOs are only one stagedeep (except where indicated), which reduces their area. To maintainperformance, lookahead connections are used to accelerate the "startup"of the pipeline. For example, when the Local-Buffer-Read block issues adata request, the Texture/Fog/Color blocks also receive this, and beginto transfer data accordingly. Normally a single-entry deep FIFO cannotbe read and written in the same cycle, as the writing side doesn't knowthat the FIFO is going to be read in that cycle (and hence becomeeligible to be written). The look-ahead feature give the writing sidethis insight, so that single-cycle transfer can be achieved. Thisaccelerates the throughput of the pipeline.

Programming Model

The following text describes the programming model for GLINT.

GLINT as a Register file

The simplest way to view the interface to GLINT is as a flat block ofmemory-mapped registers (i.e. a register file). This register fileappears as part of Region 0 of the PCI address map for GLINT. See theGLINT Hardware Reference Manual for details of this address map.

When a GLINT host software driver is initialized it can map the registerfile into its address space. Each register has an associated addresstag, giving its offset from the base of the register file (since allregisters reside on a 64-bit boundary, the tag offset is measured inmultiples of 8 bytes). The most straightforward way to load a value intoa register is to write the data to its mapped address. In reality thechip interface comprises a 16 entry deep FIFO, and each write to aregister causes the written value and the register's address tag to bewritten as a new entry in the FIFO.

Programming GLINT to draw a primitive consists of writing initial valuesto the appropriate registers followed by a write to a command register.The last write triggers the start of rendering.

GLINT has approximately 200 registers. All registers are 32 bits wideand should be 32-bit addressed. Many registers are split into bitfields, and it should be noted that bit 0 is the least significant bit.

Register Types

GLINT has three main types of register:

Control Registers

Command Registers

Internal Registers

Control Registers are updated only by the host--the chip effectivelyuses them as read-only registers. Examples of control registers are theScissor Clip unit min and max registers. Once initialized by the host,the chip only reads these registers to determine the scissor clipextents.

Command Registers are those which, when written to, typically cause thechip to start rendering (some command registers such as ResetPickResultor Sync do not initiate rendering). Normally, the host will initializethe appropriate control regismrs and then write to a command register toinitiate drawing. There are two types of command registers: begin-drawand continue-draw. Begin-draw commands cause rendering to start withthose values specified by the control registers. Continue-draw commandscause drawing to continue with internal register values as they werewhen the previous drawing operation completed. Making use ofcontinue-draw commands can significantly reduce the amount of data thathas to be loaded into GLINT when drawing multiple connected objects suchas polylines. Examples of command registers include the Render andContinueNewLine registers.

For convenience this application will usually refer to "sending a Rendercommand to GLINT" rather than saying (more precisely) "the RenderCommand register is written to, which initiates drawing".

Internal Registers are not accessible to host software. They are usedinternally by the chip to keep track of changing values. Some controlregisters have corresponding internal registers. When a begindrawcommand is sent and before rendering starts, the internal registers areupdated with the values in the corresponding control registers. If acontinue-draw command is sent then this update does not happen anddrawing continues with the current values in the internal registers. Forexample, if a line is being drawn then the StartXDom and StartY controlregisters specify the (x, y) coordinates of the first point in the line.When a begin-draw command is sent these values are copied into internalregisters. As the line drawing progresses these internal registers areupdated to contain the (x, y) coordinates of the pixel being drawn. Whendrawing has completed the internal registers contain the (x, y)coordinates of the next point that would have been drawn. If acontinue-draw command is now given these final (x, y) internal valuesare not modified and further drawing uses these values. If a begin-drawcommand had been used the internal registers would have been reloadedfrom the StartXDom and StartY registers.

For the most part internal registers can be ignored. It is helpful toappreciate that they exist in order to understand the continue-drawcommands.

GLINT I/O Interface

There are a number of ways of loading GLINT registers for a givencontext:

The host writes a value to the mapped address of the register

The host writes address-tag/data pairs into a host memory buffer anduses the on-chip DMA to transfer this data to the FIFO.

The host can perform a Block Command Transfer by writing address anddata values to the FIFO interface registers.

In all cases where the host writes data values directly to the chip (viathe register file) it has to worry about FIFO overflow. The InFIFOSpaceregister indicates how many free entries remain in the FIFO. Beforewriting to any register the host must ensure that there is enough spaceleft in the FIFO. The values in this register can be read at any time.When using DMA, the DMA controller will automatically ensure that thereis room in the FIFO before it performs further transfers. Thus a bufferof any size can be passed to the DMA controller.

FIFO Control

The description above considered the GLINT interface to be a registerfile. More precisely, when a data value is written to a register thisvalue and the address tag for that register are combined and put intothe FIFO as a new entry. The actual register is not updated until GLINTprocesses this entry. In the case where GLINT is busy performing a timeconsuming operation (e.g. drawing a large texture mapped polygon), andnot draining the FIFO very quickly, it is possible for the FIFO tobecome full. If a write to a register is performed when the FIFO is fullno entry is put into the FIFO and that write is effectively lost.

The input FIFO is 16 entries deep and each entry consists of a tag/datapair. The InFIFOSpace register can be read to determine how many entriesare free. The value returned by this register will never be greater than16.

To check the status of the FIFO before every write is very inefficient,so it is preferably checked before loading the data for each rectangle.Since the FIFO is 16 entries deep, a further optimization is to wait forall 16 entries to be free after every second rectangle. Furtheroptimizations can be made by moving dXDom, dXSub and dY outside the loop(as they are constant for each rectangle) and doing the FIFO wait afterevery third rectangle.

The InFIFOSpace FIFO control register contains a count of the number ofentries currently free in the FIFO. The chip increments this registerfor each entry it removes from the FIFO and decrements it every time thehost puts an entry in the FIFO.

The DMA Interface

Loading registers directly via the FIFO is often an inefficient way todownload data to GLINT. Given that the FIFO can accommodate only a smallnumber of entries, GLINT has to be frequently interrogated to determinehow much space is left. Also, consider the situation where a given APIfunction requires a large amount of data to be sent to GLINT. If theFIFO is written directly then a return from this function is notpossible until almost all the data has been consumed by GLINT. This maytake some time depending on the types of primitives being drawn.

To avoid these problems GLINT provides an on-chip DMA controller whichcan be used to load data from arbitrary sized (<64K 32-bit words) hostbuffers into the FIFO. In its simplest form the host software has toprepare a host buffer containing register address tag descriptions anddata values. It then writes the base address of this buffer to theDMAAddress register and the count of the number of words to transfer tothe DMACount register. Writing to the DMACount register starts the DMAtransfer and the host can now perform other work. In general, if thecomplete set of rendering commands required by a given call to a driverfunction can be loaded into a single DMA buffer then the driver functioncan return. Meanwhile, in parallel, GLINT is reading data from the hostbuffer and loading it into its FIFO. FIFO overflow never occurs sincethe DMA controller automatically waits until there is room in the FIFObefore doing any transfers.

The only restriction on the use of DMA control registers is that beforeattempting to reload the DMACount register the host software must waituntil previous DMA has completed. It is valid to load the DMAAddressregister while the previous DMA is in progress since the address islatched internally at the start of the DMA transfer.

Using DMA leaves the host free to return to the application, while inparallel, GLINT is performing the DMA and drawing. This can increaseperformance significantly over loading a FIFO directly. In addition,some algorithms require that data be loaded multiple times (e.g. drawingthe same object across multiple clipping rectangles). Since the GLINTDMA only reads the buffer data, it can be downloaded many times simplyby restarting the DMA. This can be very beneficial if composing thebuffer data is a time consuming task.

The host can use this hardware capability in various ways. For example,a further optional optimization is to use a double buffered mechanismwith two DMA buffers. This allows the second buffer to be filled beforewaiting for the previous DMA to complete, thus further improving theparallelism between host and GLINT processing. Thus, this optimizationis dependent on the allocation of the host memory. If there is only oneDMA host buffer then either it is being filled or it is beingemptied--it cannot be filled and emptied at the same time, since thereis no way for the host and DMA to interact once the DMA transfer hasstarted. The host is at liberty to allocate as many DMA buffers as itwants; two is the minimum to do double buffering, but allocating manysmall buffers is generally better, as it gives the benefits of doublebuffering together with low latency time, so GLINT is not idle whilelarge buffer is being filled up. However, use of many small buffers isof course more complicated.

In general the DMA buffer format consists of a 32-bit address tagdescription word followed by one or more data words. The DMA bufferconsists of one or more sets of these formats. The following paragraphsdescribe the different types of tag description words that can be used.

DMA Tag Description Format

There are 3 different tag addressing modes for DMA: hold, increment andindexed. The different DMA modes are provided to reduce the amount ofdata which needs to be transferred, hence making better use of theavailable DMA bandwidth. Each of these is described in the followingsections.

Hold Format

In this format the 32-bit tag description contains a tag value and acount specifying the number of data words following in the buffer. TheDMA controller writes each of the data words to the same address tag.For example, this is useful for image download where pixel data iscontinuously written to the Color register. The bottom 9 bits specifythe register to which the data should be written; the high-order 16 bitsspecify the number of data words (minus 1) which follow in the bufferand which should be written to the address tag (note that the 2-bit modefield for this format is zero so a given tag value can simply be loadedinto the low order 16 bits).

A special case of this format is where the top 16 bits are zeroindicating that a single data value follows the tag (i.e. the 32-bit tagdescription is simply the address tag value itself). This allows simpleDMA buffers to be constructed which consist of tag/data pairs.

Increment Format

This format is similar to the hold format except that as each data valueis loaded the address tag is incremented (the value in the DMA buffer isnot changed; GLINT updates an internal copy). Thus, this mode allowscontiguous GLINT registers to be loaded by specifying a single 32-bittag value followed by a data word for each register. The low-order 9bits specify the address tag of the first register to be loaded. The 2bit mode field is set to 1 and the high-order 16 bits are set to thecount (minus 1) of the number of registers to update. To enable use ofthis format, the GLINT register file has been organized so thatregisters which are frequently loaded together have adjacent addresstags. For example, the 32 AreaStipplePattern registers can be loaded asfollows:

    ______________________________________                                               AreaStipplePattern0, Count=31, Mode=1                                         row 0 bits                                                                    row 1 bits                                                                    .                                                                             .                                                                             .                                                                             row 31 bits                                                            ______________________________________                                    

Indexed Format

GLINT address tags are 9 bit values. For the purposes of the Indexed DMAFormat they are organized into major groups and within each group thereare up to 16 tags. The low-order 4 bits of a tag give its offset withinthe group. The high-order 5 bits give the major group number.

The following Register Table lists the individual registers with theirMajor Group and Offset in the presently preferred embodiment:

Register Table

The following table lists registers by group, giving their tag valuesand indicating their type. The register groups may be used to improvedata transfer rates to GLINT when using DMA.

The following types of register are distinguished:

    ______________________________________                                                              Major    Offse                                                                Group    t                                              Unit    Register      (hex)    (hex) Type                                     ______________________________________                                        Rasterizer                                                                            StartXDom     00       0     Control                                          dXDom         00       1     Control                                          StartXSub     00       2     Control                                          dXSub         00       3     Control                                          StartY        00       4     Control                                          dY            00       5     Control                                          Count         00       6     Control                                          Render        00       7     Command                                          ContinueNewLine                                                                             00       8     Command                                          ContinueNewDom                                                                              00       9     Command                                          ContinueNewSub                                                                              00       A     Command                                          Continue      00       B     Command                                          FlushSpan     00       C     Command                                          BitMaskPattern                                                                              00       D     Mixed                                    Rasterizer                                                                            PointTable 0-3!                                                                             01       0-3   Control                                          RasterizerMode                                                                              01       4     Control                                  Scissor ScissorMode   03       0     Control                                  Stipple                                                                               ScissorMinXY  03       1     Control                                          ScissorMaxXY  03       2     Control                                          ScreenSize    03       3     Control                                          AreaStippleMode                                                                             03       4     Control                                          LineStippleMode                                                                             03       5     Control                                          LoadLineStippleC                                                                            03       6     Control                                          ounters                                                                       UpdateLineStipple                                                                           03       7     Command                                          Counters                                                                      SaveLineStippleSt                                                                           03       8     Command                                          ate                                                                           WindowOrigin  03       9     Control                                  Scissor AreaStipplePatter                                                                           04       0-F   Control                                  Stipple n 0-31!       05       0-F                                            Texture Texel0        0C       0     Control                                  Color/Fog                                                                             Texel1        0C       1     Control                                          Texel2        0C       2     Control                                          Texel3        0C       3     Control                                          Texel4        0C       4     Control                                          Texel5        0C       5     Control                                          Texel6        0C       6     Control                                          Texel7        0C       7     Control                                          Interp0       0C       8     Control                                          Interp1       0C       9     Control                                          Interp2       0C       A     Control                                          Interp3       0C       B     Control                                          Interp4       0C       C     Control                                          TextureFilter 0C       D     Control                                  Texture/Fog                                                                           TextureColorMod                                                                             0D       0     Control                                  Color   e                                                                             TextureEnvColor                                                                             0D       1     Control                                          FogMode       0D       2     Control                                          FogColor      0D       3     Control                                          FStart        0D       4     Control                                          dFdx          0D       5     Control                                          dFdyDom       0D       6     Control                                  Color DDA                                                                             RStart        0F       0     Control                                          dRdx          0F       1     Control                                          dRdyDom       0F       2     Control                                          GStart        0F       3     Control                                          dGdx          0F       4     Control                                          dGdyDom       0F       5     Control                                          BStart        0F       6     Control                                          dBdx          0F       7     Control                                          dBdyDom       0F       8     Control                                          AStart        0F       9     Control                                          dAdx          0F       A     Control                                          dAdyDom       0F       B     Control                                          ColorDDAMode  0F       C     Control                                          ConstantColor 0F       D     Control                                          Color         0F       E     Mixed                                    Alpha Test                                                                            AlphaTestMode 10       0     Control                                          AntialiasMode 10       1     Control                                  Alpha Blend                                                                           AlphaBlendMode                                                                              10       2     Control                                  Dither  DitherMode    10       3     Control                                  Logical Ops                                                                           FBSoftwareWrite                                                                             10       4     Control                                          Mask                                                                          LogicalOpMode 10       5     Control                                          FBWriteData   10       6     Control                                  LB Read LBReadMode    11       0     Control                                          LBReadFormat  11       1     Control                                          LBSourceOffset                                                                              11       2     Control                                          LBStencil     11       5     Output                                           LBDepth       11       6     Output                                           LBWindowBase  11       7     Control                                  LB Write                                                                              LBWriteMode   11       8     Control                                          LBWriteFormat 11       9     Control                                  GID/Stencil/                                                                          Window        13       0     Control                                  Depth                                                                                 StencilMode   13       1     Control                                          StencilData   13       2     Control                                          Stencil       13       3     Mixed                                            DepthMode     13       4     Control                                          Depth         13       5     Mixed                                            ZStartU       13       6     Control                                          ZStartL       13       7     Control                                          dZdxU         13       8     Control                                          dZdxL         13       9     Control                                          dZdyDomU      13       A     Control                                          dzdyDomL      13       B     Control                                          FastClearDepth                                                                              13       C     Control                                  FB Read FBReadMode    15       0     Control                                          FBSourceOffset                                                                              15       1     Control                                          FBPixelOffset 15       2     Control                                          FBColor       15       3     Output                                           FBWindowBase  15       6     Control                                  FB Write                                                                              FBWriteMode   15       7     Control                                          FBHardwareWrite                                                                             15       8     Control                                          Mask                                                                          FBBlockColor  15       9     Control                                  Host Out                                                                              FilterMode    18       0     Control                                          StatisticMode 18       1     Control                                          MinRegion     18       2     Control                                          MaxRegion     18       3     Control                                          ResetPickResult                                                                             18       4     Command                                          MinHitRegion  18       5     Command                                          MaxHitRegion  18       6     Command                                          PickResult    18       7     Command                                          Sync          18       8     Command                                  ______________________________________                                    

This format allows up to 16 registers within a group to be loaded whilestill only specifying a single address tag description word.

If the Mode of the address tag description word is set to indexed mode,then the high-order 16 bits are used as a mask to indicate whichregisters within the group are to be used. The bottom 4 bits of theaddress tag description word are unused. The group is specified by bits4 to 8. Each bit in the mask is used to represent a unique tag withinthe group. If a bit is set then the corresponding register will beloaded. The number of bits set in the mask determines the number of datawords that should be following the tag description word in the DMAbuffer. The data is stored in order of increasing corresponding addresstag.

DMA Buffer Addresses

Host software must generate the correct DMA buffer address for the GLINTDMA controller. Normally, this means that the address passed to GLINTmust be the physical address of the DMA buffer in host memory. Thebuffer must also reside at contiguous physical addresses as accessed byGLINT. On a system which uses virtual memory for the address space of atask, some method of allocating contiguous physical memory, and mappingthis into the address space of a task, must be used.

If the virtual memory buffer maps to non-contiguous physical memory,then the buffer must be divided into sets of contiguous physical memorypages and each of these sets transferred separately. In such a situationthe whole DMA buffer cannot be transferred in one go; the host softwaremust wait for each set to be transferred. Often the best way to handlethese fragmented transfers is via an interrupt handler.

DMA Interrupts

GLINT provides interrupt support, as an alternative means of determiningwhen a DMA transfer is complete. If enabled, the interrupt is generatedwhenever the DMACount register changes from having a non-zero to havinga zero value. Since the DMACount register is decremented every time adata item is transferred from the DMA buffer this happens when the lastdata item is transferred from the DMA buffer.

To enable the DMA interrupt, the DMAInterruptEnable bit must be set inthe IntEnable register. The interrupt handler should check the DMAFlagbit in the IntFlags register to determine that a DMA interrupt hasactually occurred. To clear the interrupt a word should be written tothe IntFlags register with the DMAFlag bit set to one.

This scheme frees the processor for other work while DMA is beingcompleted. Since the overhead of handling an interrupt is often quitehigh for the host processor, the scheme should be tuned to allow aperiod of polling before sleeping on the interrupt.

Output FIFO and Graphics Processor FIFO Interface

To read data back from GLINT an output FIFO is provided. Each entry inthis FIFO is 32-bits wide and it can hold tag or data values. Thus itsformat is unlike the input FIFO whose entries are always tag/data pairs(we can think of each entry in the input FIFO as being 41 bits wide: 9bits for the tag and 32 bits for the data). The type of data written byGLINT to the output FIFO is controlled by the FilterMode register. Thisregister allows filtering of output data in various categories includingthe following:

Depth:

output in this category results from an image upload of the Depthbuffer.

Stencil:

output in this category results from an image upload of the Stencilbuffer.

Color:

output in this category results from an image upload of the framebuffer.

Synchronization:

synchronization data is sent in response to a Sync command.

The data for the FilterMode register consists of 2 bits per category. Ifthe least significant of these two bits is set (0×1) then output of theregister tag for that category is enabled; if the most significant bitis set (0×2) then output of the data for that category is enabled. Bothtag and data output can be enabled at the same time. In this case thetag is written first to the FIFO followed by the data.

For example, to perform an image upload from the framebuffer, theFilterMode register should have data output enabled for the Colorcategory. Then, the rectangular area to be uploaded should be describedto the rasterizer. Each pixel that is read from the framebuffer willthen be placed into the output FIFO. If the output FIFO becomes full,then GLINT will block internally until space becomes available. It isthe programmer's responsibility to read all data from the output FIFO.For example, it is important to know how many pixels should result froman image upload and to read exactly this many from the FIFO.

To read data from the output FIFO the OutputFIFOWords register shouldfirst be read to determine the number of entries in the FIFO (readingfrom the FIFO when it is empty returns undefined data). Then this many32-bit data items are read from the FIFO. This procedure is repeateduntil all the expected data or tag items have been read. The address ofthe output FIFO is described below.

Note that all expected data must be read back. GLINT will block if theFIFO becomes full. Programmers must be careful to avoid the deadlockcondition that will result if the host is waiting for space to becomefree in the input FIFO while GLINT is waiting for the host to read datafrom the output FIFO.

Graphics Processor FIFO Interface

GLINT has a sequence of 1K×32 bit addresses in the PCI Region 0 addressmap called the Graphics Processor FIFO Interface. To read from theoutput FIFO any address in this range can be read (normally a programwill choose the first address and use this as the address for the outputFIFO). All 32-bit addresses in this region perform the same function:the range of addresses is provided for data transfer schemes which forcethe use of incrementing addresses.

Writing to a location in this address range provides raw access to theinput FIFO. Again, the first address is normally chosen. Thus the sameaddress can be used for both input and output FIFOs. Reading givesaccess to the output FIFO; writing gives access to the input FIFO.

Writing to the input FIFO by this method is different from writing tothe memory mapped register file. Since the register file has a uniqueaddress for each register, writing to this unique address allows GLINTto determine the register for which the write is intended. This allows atag/data pair to be constructed and inserted into the input FIFO. Whenwriting to the raw FIFO address an address tag description must first bewritten followed by the associated data. In fact, the format of the tagdescriptions and the data that follows is identical to that describedabove for DMA buffers. Instead of using the GLINT DMA it is possible totransfer data to GLINT by constructing a DMA-style buffer of data andthen copying each item in this buffer to the raw input FIFO address.Based on the tag descriptions and data written GLINT constructs tag/datapairs to enter as real FIFO entries. The DMA mechanism can be thought ofas an automatic way of writing to the raw input FIFO address.

Note, that when writing to the raw FIFO address the FIFO full conditionmust still be checked by reading the InFIFOSpace register. However,writing tag descriptions does not cause any entries to be entered intothe FIFO: such a write simply establishes a set of tags to be pairedwith the subsequent data. Thus, free space need be ensured only foractual data items that are written (not the tag values). For example, inthe simplest case where each tag is followed by a single data item,assuming that the FIFO is empty, then 32 writes are possible beforechecking again for free space.

Other Interrupts

GLINT also provides interrupt facilities for the following:

Sync:

If a Sync command is sent and the Sync interrupt has been enabled thenonce all rendering has been completed, a data value is entered into theHost Out FIFO, and a Sync interrupt is generated when this value reachesthe output end of the FIFO. Synchronization is described further in thenext section.

External:

this provides the capability for external hardware on a GLINT board(such as an external video timing generator) to generate interrupts tothe host processor.

Error:

if enabled the error interrupt will occur when GLINT detects certainerror conditions, such as an attempt to write to a full FIFO.

Vertical Retrace:

if enabled a vertical retrace interrupt is generated at the start of thevideo blank period.

Each of these are enabled and cleared in a similar way to the DMAinterrupt.

Synchronization

There are three main cases where the host must synchronize with GLINT:

before reading back from registers

before directly accessing the framebuffer or the localbuffer via thebypass mechanism

framebuffer management tasks such as double buffering

Synchronizing with GLINT implies waiting for any pending DMA to completeand waiting for the chip to complete any processing currently beingperformed. The following pseudo-code shows the general scheme:

    ______________________________________                                        GLINTData data;                                                               // wait for DMA to complete                                                   while (*DMACount |= 0) {                                                       poll or wait for interrupt                                                   while (*InFIFOSpace < 2) {                                                     ; // wait for free space in the FIFO                                         }                                                                             // enable sync output and send the Sync command                               data.Word = 0;                                                                data.FilterMode.Synchronization = 0×1;                                  FilterMode(data.Word);                                                        Sync(0×0);                                                              /* wait for the sync output data */                                           do {                                                                           while (*OutFIFOWords == 0)                                                     ; // poll waiting for data in output                                        FIFO                                                                          } while (*OutputFIFO |= Sync.sub.-- tag);                                     ______________________________________                                    

Initially, we wait for DMA to complete as normal. We then have to waitfor space to become free in the FIFO (since the DMA controller actuallyloads the FIFO). We need space for 2 registers: one to enable generationof an output sync value, and the Sync command itself. The enable flagcan be set at initialization time. The output value will be generatedonly when a Sync command has actually been sent, and GLINT has thencompleted all processing.

Rather than polling it is possible to use a Sync interrupt as mentionedin the previous section. As well as enabling the interrupt and settingthe filter mode, the data sent in the Sync command must have the mostsignificant bit set in order to generate the interrupt. The interrupt isgenerated when the tag or data reaches the output end of the Host OutFIFO. Use of the Sync interrupt has to be considered carefully as GLINTwill generally empty the FIFO more quickly than it takes to set up andhandle the interrupt.

Host Framebuffer Bypass

Normally, the host will access the framebuffer indirectly via commandssent to the GLINT FIFO interface. However, GLINT does provide the wholeframebuffer as part of its address space so that it can be memory mappedby an application. Access to the framebuffer via this memory mappedroute is independent of the GLINT FIFO.

Drivers may choose to use direct access to the framebuffer foralgorithms which are not supported by GLINT. The framebuffer bypasssupports big-endian, little-endian and GIB-endian formats.

A driver making use of the framebuffer bypass mechanism shouldsynchronize framebuffer accesses made through the FIFO with those madedirectly through the memory map. If data is written to the FIFO and thenan access is made to the framebuffer, it is possible that theframebuffer access will occur before the commands in the FIFO have beenfully processed. This lack of temporal ordering is generally notdesirable.

Framebuffer Dimensions and Depth

At reset time the hardware stores the size of the framebuffer in theFBMemoryControl register. This register can be read by software todetermine the amount of VRAM on the display adapter. For a given amountof VRAM, software can configure different screen resolutions andoff-screen memory regions.

The framebuffer width must be set up in the FBReadMode register. Thefirst 9 bits of this register define 3 partial products which determinethe offset in pixels from one scanline to the next. Typically, thesevalues will be worked out at initialization time and a copy kept insoftware. When this register needs to be modified the software copy isretrieved and any other bits modified before writing to the register.

Once the offset from one scanline to the next has been established,determining the visible screen width and height becomes a clippingissue. The visible screen width and height are set up in the ScreenSizeregister and enabled by setting the ScreenScissorEnable bit in theScissorMode register.

The framebuffer depth (8, 16 or 32-bit) is controlled by the FBModeSelregister. This register provides a 2 bit field to control which of thethree pixel depths is being used. The pixel depth can be changed at anytime but this should not be attempted without first synchronizing withGLINT. The FBModeSel register is not a FIFO register and is updatedimmediately it is written. If GLINT is busy performing renderingoperations, changing the pixel depth will corrupt that rendering.

Normally, the pixel depth is set at initialization time. To optimizecertain 2D rendering operations it may be desirable to change it atother times. For example, if the pixel depth is normally 8 (or 16) bits,changing the pixel depth to 32 bits for the duration of a bitblt canquadruple (or double) the blt speed, when the bit source and destinationedges are aligned on 32 bit boundaries. Once such a bit sequence hasbeen set up the host software must wait and synchronize with GLINT andthen reset the pixel depth before continuing with further rendering. Itis not possible to change the pixel depth via the FIFO, thus explicitsynchronization must always be used.

Host Localbuffer Bypass

As with the framebuffer, the localbuffer can be mapped in and accesseddirectly. The host should synchronize with GLINT before making anydirect access to the localbuffer.

At reset time the hardware saves the size of the localbuffer in theLBMemoryControl register (localbuffer visible region size). In bypassmode the number of bits per pixel is either 32 or 64. This informationis also set in the LBMemoryControl register (localbuffer bypasspacking). This pixel packing defines the memory offset between one pixeland the next. A further set of 3 bits (localbuffer width) in theLBMemoryControl register defines the number of valid bits per pixel. Atypical localbuffer configuration might be 48 bits per pixel but inbypass mode the data for each pixel starts on a 64-bit boundary. In thiscase valid pixel data will be contained in bits 0 to 47. Software mustset the LBReadFormat register to tell GLINT how to interpret these validbits.

Host software must set the width in pixels of each scanline of thelocalbuffer in the LBReadMode FIFO register. The first 9 bits of thisregister define 3 partial products which determine the offset in pixelsfrom one scanline to the next. As with the framebuffer partial products,these values will usually be worked out at initialization time and acopy kept in software. When this register needs to be modified thesoftware copy is retrieved and any other bits modified before writing tothe register. If the system is set up so that each pixel in theframebuffer has a corresponding pixel in the localbuffer then this widthwill be the same as that set for the framebuffer.

The localbuffer is accessible via Regions 1 and 3 of the PCI address mapfor GLINT. The localbuffer bypass supports big-endian and little-endianformats. These are described in a later section.

Register Read Back

Under some operating environments, multiple tasks will want access tothe GLINT chip. Sometimes a server task or driver will want to arbitrateaccess to GLINT on behalf of multiple applications. In thesecircumstances, the state of the GLINT chip may need to be saved andrestored on each context switch. To facilitate this, the GLINT controlregisters can be read back. (However, internal and command registerscannot be read back.)

To perform a context switch the host must first synchronize with GLINT.This means waiting for outstanding DMA to complete, sending a Synccommand and waiting for the sync output data to appear in the outputFIFO. After this the registers can be read back.

To read a GLINT register the host reads the same address which would beused for a write, i.e. the base address of the register file plus theoffset value for the register.

Note that since internal registers cannot be read back care must betaken when context switching a task which is making use of continue-drawcommands. Continue-draw commands rely on the internal registersmaintaining previous state. This state will be destroyed by anyrendering work done by a new task. To prevent this, continue-drawcommands should be performed via DMA since the context switch code hasto wait for outstanding DMA to complete. Alternatively, continue-drawcommands can be performed in a non-preemptable code segment.

Normally, reading back individual registers should be avoided. The needto synchronize with the chip can adversely affect performance. It isusually more appropriate to keep a software copy of the register whichis updated when the actual register is updated.

Byte Swapping

Internally GLINT operates in little-endian mode. However, GLINT isdesigned to work with both big- and little-endian host processors. Sincethe PCIBus specification defines that byte ordering is preservedregardless of the size of the transfer operation, GLINT providesfacilities to handle byte swapping. Each of the Configuration Space,Control Space, Framebuffer Bypass and Localbuffer Bypass memory areashave both big and little endian mappings available. The mapping to usetypically depends on the endian ordering of the host processor.

The Configuration Space may be set by a resistor in the board design tobe either little endian or big endian.

The Control Space in PCI address region 0, is 128K bytes in size, andconsists of two 64K sized spaces. The first 64K provides little endianaccess to the control space registers; the second 64K provides bigendian access to the same registers.

The framebuffer bypass consists of two PCI address regions: Region 2 andRegion 4. Each is independently configurable to by the Aperture0 andAperture1 control registers respectively, to one of three modes: no byteswap, 16-bit swap, full byte swap. Note that the 16 bit mode is neededfor the following reason. If the framebuffer is configured for 16-bitpixels and the host is big-endian then simply byte swapping is notenough when a 32-bit access is made (to write two pixels). In this case,the required effect is that the bytes are swapped within each 16-bitword, but the two 16-bit halves of the 32-bit word are not swapped. Thispreserves the order of the pixels that are written as well as the byteordering within each pixel. The 16 bit mode is referred to as GIB-endianin the PCI Multimedia Design Guide, version 1.0.

The localbuffer bypass consists of two PCI address regions: Region 1 andRegion 3. Each is independently configurable to by the Aperture0 andAperture1 control registers respectively, to one of two modes: no byteswap, full byte swap.

To save on the size of the address space required for GLINT, boardvendors may choose to turn off access to the big endian regions (3 and4) by the use of resistors on the board.

There is a bit available in the DMAControl control register to enablebyte swapping of DMA data. Thus for big-endian hosts, this control bitwould normally be enabled.

Red and Blue Swapping

For a given graphics board the RAMDAC and/or API will usually force agiven interpretation for true color pixel values. For example, 32-bitpixels will be interpreted as either ARGB (alpha at byte 3, red at byte2, green at byte 1 and blue at byte 0) or ABGR (blue at byte 2 and redat byte 0). The byte position for red and blue may be important forsoftware which has been written to expect one byte order or the other,in particular when handling image data stored in a file.

GLINT provides two registers to specify the byte positions of blue andred internally. In the Alpha Blend Unit the AlphaBlendMode registercontains a 1-bit field called ColorOrder. If this bit is set to zerothen the byte ordering is ABGR; if the bit is set to one then theordering is ARGB. As well as setting this bit in the Alpha Blend unit,it must also be set in the Color Formatting unit. In this unit theDitherMode register contains a Color Order bit with the sameinterpretation. The order applies to all of the true color pixelformats, regardless of the pixel depth.

Hardware Data Structures

Some of the hardware data structure implementations used in thepresently preferred embodiment will now be described in detail. 0fcourse these examples are provided merely to illustrate the presentlypreferred embodiment in great detail, and do not necessarily delimit anyof the claimed inventions.

Localbuffer

The localbuffer holds the per pixel information corresponding to eachdisplayed pixel and any texture maps. The per pixel information held inthe localbuffer are Graphic ID (GID), Depth, Stencil and Frame CountPlanes (FCP). The possible formats for each of these fields, and theiruse are covered individually in the following sections.

The maximum width of the localbuffer is 48 bits, but this can be reducedby changing the external memory configuration, albeit at the expense ofreducing the functionality or dynamic range of one or more of thefields.

The localbuffer memory can be from 16 bits (assuming a depth buffer isalways needed) to 48 bits wide in steps of 4 bits. The four fieldssupported in the localbuffer, their allowed lengths and positions areshown in the following table:

    ______________________________________                                        Field      Lengths   Start bit positions                                      ______________________________________                                        Depth      16, 24, 32                                                                              0                                                        Stencil    0, 4, 8   16, 20, 24, 28, 32                                       FrameCount 0, 4, 8   16, 20, 24, 28, 32, 36, 40                               GID        0, 4      16, 20, 24, 28, 32, 36, 40, 44, 48                       ______________________________________                                    

The order of the fields is as shown with the depth field at the leastsignificant end and GID field at the most significant end. The GID is atthe most significant end so that various combinations of the Stencil andFrameCount field widths can be used on a per window basis without theposition of the GID fields moving. If the GID field is in a differentpositions in different windows then the ownership tests becomeimpossible to do.

The GID, FrameCount, Stencil and Depth fields in the localbuffer areconverted into the internal format by right justification if they areless than their internal widths, i.e. the unused bits are the mostsignificant bits and they are set to 0.

The format of the localbuffer is specified in two places: theLBReadFormat register and the LBWriteFormat register.

It is still possible to part populate the localbuffer so othercombinations of the field widths are possible (i.e. depth field width of0), but this may give problems if texture maps are to be stored in thelocalbuffer as well.

Any non-bypass read or write to the localbuffer always reads or writesall 48 bits simultaneously.

GID field

The 4 bit GID field is used for pixel ownership tests to allow per pixelwindow clipping. Each window using this facility is assigned one of theGID values, and the visible pixels in the window have their GID fieldset to this value. If the test is enabled the current GID (set tocorrespond with the current window) is compared with the GID in thelocalbuffer for each fragment. If they are equal this pixel belongs tothe window so the localbuffer and framebuffer at this coordinate may beupdated.

Using the GID field for pixel ownership tests is optional and othermethods of achieving the same result are:

clip the primitive to the window's boundary (or rectangular tiles whichmake up the window's area) and render only the visible parts of theprimitive

use the scissor test to define the rectangular tiles which make up thewindow's visible area and render the primitive once per tile (This maybe limited to only those tiles which the primitive intersects).

Depth Field

The depth field holds the depth (Z) value associated with a pixel andcan be 16, 24 or 32 bits wide.

Stencil Field

The stencil field holds the stencil value associated with a pixel andcan be 0, 4 or 8 bits wide.

The width of the stencil buffer is also stored in the StencilModeregister and is needed for clamping and masking during the updatemethods. The stencil compare mask should be set up to exclude any absentbits from the stencil compare operation.

FrameCount Field

The Frame Count Field holds the frame count value associated with apixel and can be 0, 4 or 8 bits wide. It is used during animation tosupport a fast clear mechanism to aid the rapid clearing of the depthand/or stencil fields needed at the start of each frame.

In addition to the fast clear mechanism the extent of all updates to thelocalbuffer and framebuffer can be recorded (MinRegion and MaxRegionregisters) and read back (MinHitRegion and MaxHitRegion commands) togive the bounding box of the smallest area to clear. For someapplications this will be significantly smaller than the whole window orscreen, and hence faster.

The fast clear mechanism provides a method where the cost of clearingthe depth and stencil buffers can be amortized over a number of clearoperations issued by the application. This works as follows:

The window is divided up into n regions, where n is the range of theframe counter (16 or 256). Every time the application issues a clearcommand the reference frame counter is incremented (and allowed to rollover if it exceeds its maximum value) and the n^(th) region is clearedonly. The clear updates the depth and/or stencil buffers to the newvalues and the frame count buffer with the reference value. This regionis much smaller than the full window and hence takes less time to clear.

When the localbuffer is subsequently read and the frame count is foundto be the same as the reference frame count (held in the Windowregister) the localbuffer data is used directly. However, if the framecount is found to be different from the reference frame count (held inthe Window register) the data which would have been written, if thelocalbuffer had been cleared properly, is substituted for the stale datareturned from the read. Any new writes to the localbuffer will set theframe count to the reference value so the next read on this pixel worksnormally without the substitution. The depth data to substitute is heldin the FastClearDepth register and the stencil data to substitute isheld in the StencilData register (along with other stencil information).

The fast clear mechanism does not present a total solution as the usercan elect to clear just the stencil planes or just the depth planes, orboth. The situation where the stencil planes only are `cleared` usingthe fast clear method, then some rendering is done and then the depthplanes are `cleared` using the fast clear will leave ambiguous pixels inthe localbuffer. The driver software will need to catch this situation,and fall back to using a per pixel write to do the second clear. Whichfield(s) the frame count plane refers to is recorded in the Windowregister.

When clear data is substituted for real memory data (during normalrendering operations) the depth write mask and stencil write masks areignored to mimic the OpenGL operation when a buffer is cleared.

Localbuffer Coordinates

The coordinates generated by the rasterizer are 16 bit 2's complementnumbers, and so have the range +32767 to -32768. The rasterizer willproduce values in this range, but any which have a negative coordinate,or exceed the screen width or height (as programmed into the ScreenSizeregister) are discarded.

Coordinates can be defined window relative or screen relative and thisis only relevant when the coordinate gets converted to an actualphysical address in the localbuffer. In general it is expected that thewindowing system will use absolute coordinates and the graphics systemwill use relative coordinates (to be independent of where the windowreally is).

GUI systems (such as Windows, Windows NT and X) usually have the originof the coordinate system at the top left corner of the screen but thisis not true for all graphics systems. For instance OpenGL uses thebottom left corner as its origin. The WindowOrigin bit in the LBReadModeregister selects the top left (0) or bottom left (1) as the origin.

The actual equations used to calculate the localbuffer address to readand write are:

    ______________________________________                                        Bottom left origin:                                                            Destination address = LBWindowBase - Y*W + X                                  Source address =                                                               LBWindowBase - Y*W + X + LBSourceOffset                                     Top left origin:                                                               Destination address = LBWindowBase + Y*W + X                                  Source address =                                                               LBWindowBase + Y*W + X + LBSourceOffset                                     ______________________________________                                    

where:

X is the pixel's X coordinate.

Y is the pixel's Y coordinate.

LBWindowBase holds the base address in the localbuffer of the currentwindow.

LBSourceOffset is normally zero except during a copy operation wheredata is read from one address and written to another address. The offsetbetween source and destination is held in the LBSourceOffset register.

W is the screen width. Only a subset of widths are supported and theseare encoded into the PP0, PP1 and PP2 fields in the LBReadMode register.

These address calculations translate a 2D address into a linear address.

The Screen width is specified as the sum of selected partial products soa full multiply operation is not needed. The partial products areselected by the fields PP0, PP1 and PP2 in the LBReadMode register.

For arbitrary width screens, for instance bitmaps in `off screen`memory, the next largest width from the table must be chosen. Thedifference between the table width and the bitmap width will be anunused strip of pixels down the right hand side of the bitmap.

Note that such bitmaps can be copied to the screen only as a series ofscanlines rather than as a rectangular block. However, often windowingsystems store offscreen bitmaps in rectangular regions which use thesame stride as the screen. In this case normal bitblts can be used.

Texture Memory

The localbuffer is used to hold textures in the GLINT 400TX variant. Inthe GLINT 300SX variant the texture information is supplied by the host.

Framebuffer

The framebuffer is a region of memory where the information producedduring rasterization is written prior to being displayed. Thisinformation is not restricted to color but can include window controldata for LUT management and double buffering.

The framebuffer region can hold up to 32MBytes and there are very fewrestrictions on the format and size of the individual buffers which makeup the video stream. Typical buffers include:

True color or color index main planes,

Overlay planes,

Underlay planes,

Window ID planes for LUT and double buffer management,

Cursor planes.

Any combination of these planes can be supported up to a maximum of 32MBytes, but usually it is the video level processing which is thelimiting factor. The following text examines the options and choicesavailable from GLINT for rendering, copying, etc. data to these buffers.

To access alternative buffers either the FBPixelOffset register can beloaded, or the base address of the window held in the FBWindow-Baseregister can be redefined. This is described in more detail below.

Buffer Organization

Each buffer resides at an address in the framebuffer memory map. Forrendering and copying operations the actual buffer addresses can be onany pixel boundary. Display hardware will place some restrictions onthis as it will need to access the multiple buffers in parallel to mixthe buffers together depending on their relative priority, opacity anddouble buffer selection. For instance, visible buffers (rather thanoffscreen bitmaps) will typically need to be on a page boundary.

Consider the following highly configured example with a 1280×1024 doublebuffered system with 32 bit main planes (RGBA), 8 bit overlay and 4 bitsof window control information (WID).

Combining the WID and overlay planes in the same 32 bit pixel has theadvantage of reducing the amount of data to copy when a window moves, asonly two copies are required--one for the main planes and one for theoverlay and WID planes.

Note the position of the overlay and WID planes. This was not anarbitrary choice but one imposed by the (presumed) desire to use thecolor processing capabilities of GLINT (dither and interpolation) in theoverlay planes. The conversion of the internal color format to theexternal one stored in the framebuffer depends on the size and positionof the component. Note that GLINT does not support all possibleconfigurations. For example; if the overlay and WID bits were swapped,then eight bit color index starting at bit 4 would be required to renderto the overlay, but this is not supported.

Framebuffer Coordinates

Coordinate generation for the framebuffer is similar to that for thelocalbuffer, but there are some key differences.

As was mentioned before, the coordinates generated by the rasterizer are16 bit 2's complement numbers. Coordinates can be defined as windowrelative or screen relative, though this is only relevant when thecoordinate gets converted to an actual physical address in theframebuffer. The WindowOrigin bit in the FBReadMode register selects topleft (0) or bottom left (1) as the origin for the framebuffer.

The actual equations used to calculate the framebuffer address to readand write are:

    ______________________________________                                        Bottom left origin:                                                            Destination address = FBWindowBase - Y*W + X +                                 FBPixelOffset                                                                Source address = FBWindowBase - Y*W + X +                                      FBPixelOffset + FBSourceOffset                                              Top left origin:                                                               Destination address = FBWindowBase + Y*W + X +                                 FBPixelOffset                                                                Source address = FBWindowBase + Y*W + X +                                      FBPixelOffset + FBSourceOffset                                              ______________________________________                                    

These address calculations translate a 2D address into a linear address,so non power of two framebuffer widths (i.e. 1280) are economical inmemory.

The width is specified as the sum of selected partial products so a fullmultiply operation is not needed. The partial products are selected bythe fields PP0, PP1 and PP2 in the FBReadMode register. This is the samemechanism as is used to set the width of the localbuffer, but the widthsmay be set independently.

For arbitrary screen sizes, for instance when rendering to `off screen`memory such as bitmaps the next largest width from the table must bechosen. The difference between the table width and the bitmap width willbe an unused strip of pixels down the right hand side of the bitmap.

Note that such bitmaps can be copied to the screen only as a series ofscanlines rather than as a rectangular block. However, often windowingsystems store offscreen bitmaps in rectangular regions which use thesame stride as the screen. In this case normal bitblts can be used.

Color Formats

The contents of the framebuffer can be regarded in two ways:

As a collection of fields of up to 32 bits with no meaning or assumedformat as far as GLINT is concerned. Bit planes may be allocated tocontrol cursor, LUT, multi-buffer visibility or priority functions. Inthis case GLINT will be used to set and clear bit planes quickly but notperform any color processing such as interpolation or dithering. All thecolor processing can be disabled so that raw reads and writes are doneand the only operations are write masking and logical ops. This allowsthe control planes to be updated and modified as necessary. Obviouslythis technique can also be used for overlay buffers, etc. providingcolor processing is not required.

As a collection of one or more color components. All the processing ofcolor components, except for the final write mask and logical ops aredone using the internal color format of 8 bits per red, green, blue andalpha color channels. The final stage before write mask and logical opsprocessing converts the internal color format to that required by thephysical configuration of the framebuffer and video logic. Thenomenclature n@m means this component is n bits wide and starts at bitposition m in the framebuffer. The least significant bit position is 0and a dash in a column indicates that this component does not exist forthis mode. The ColorOrder is specified by a bit in the DitherModeregister.

Some important points to note:

The alpha channel is always associated with the RGB color channelsrather than being a separate buffer. This allows it to be moved inparallel and to work correctly in multi-buffer updates and doublebuffering. If the framebuffer is not configured with an alpha channel(e.g. 24 bit framebuffer width with 8:8:8:8 RGB format) then some of therendering modes which use the retained alpha buffer cannot be used. Inthese cases the NoAlphaBuffer bit in the AlphaBlendMode register shouldbe set so that an alpha value of 255 is substituted. For the RGB modeswhere no alpha channel is present (e.g. 3:3:2) then this substitution isdone automatically.

For the Front and Back modes the data value is replicated into bothbuffers.

All writes to the framebuffer try to update all 32 bits irrespective ofthe color format. This may not matter if the memory planes don't exist,but if they are being used (as overlay planes, for example) then thewrite masks (FBSoftwareWriteMask or FBHardwareWriteMask) must be set upto protect the alternative planes.

When reading the framebuffer RGBA components are scaled to theirinternal width of 8 bits, if needed for alpha blending.

CI values are left justified with the unused bits (if any) set to zeroand are subsequently processed as the red component. The result isreplicated into each of the streams G,B and A giving four copies for CI8and eight copies for CI4.

The 4:4:4:4 Front and Back formats are designed to support 12 bit doublebuffering with 4 bit Alpha, in a 32 bit system.

The 3:3:2 Front and Back formats are designed to support 8 bit doublebuffering in a 16 bit system.

The 1:2:1 Front and Back formats are designed to support 4 bit doublebuffering in an 8 bit system.

It is possible to have a color index buffer at other positions as longas reduced functionality is acceptable. For example a 4 bit CI buffer atbit position 16 can be achieved using write masking and 4:4:4:4 Frontformat with color interpolation, but dithering is lost.

The format information needs to be stored in two places: the DitherModeregister and the AlphaBlendMode register.

    ______________________________________                                                    Internal Color Channel                                            Format  Name      R       G       B     A                                     ______________________________________                                        Color Order: RGB                                                              0       8:8:8:8   8@0     8@8      8@16 8@24                                  1       5:5:5:5   5@0     5@5      5@10 5@15                                  2       4:4:4:4   4@0     4@4     4@8   4@12                                  3       4:4:4:4   4@0     4@8      4@16 4@24                                          Front     4@4      4@12    4@20 4@28                                  4       4:4:4:4   4@0     4@8      4@16 4@24                                          Back      4@4      4@12    4@20 4@28                                  5       3:3:2     3@0     3@3     2@6   --                                            Front     3@8      3@11    2@14                                       6       3:3:2     3@0     3@3     2@6   --                                            Back      3@8      3@11    2@14                                       7       1:2:1     1@0     2@1     1@3   --                                            Front     1@4     2@5     1@7                                         8       1:2:1     1@0     2@1     1@3   --                                            Back      1@4     2@5     1@7                                         Color Order: BGR                                                              0       8:8:8:8    8@16   8@8     8@0   8@24                                  1       5:5:5:5    5@10   5@5     5@0   5@15                                  2       4:4:4:4   4@8     4@4     4@0   4@12                                  3       4:4:4:4    4@16   4@8     4@0   4@24                                          Front      4@20    4@12   4@4   4@28                                  4       4:4:4:4    4@16   4@8     4@0   4@24                                          Back       4@20    4@12   4@4   4@28                                  5       3:3:2     3@5     3@2     2@0   --                                            Front      3@13    3@10   2@8                                         6       3:3:2     3@5     3@2     2@0   --                                            Back       3@13    3@10   2@8                                         7       1:2:1     1@3     2@1     1@0   --                                            Front     1@7     2@5     1@4                                         8       1:2:1     1@3     2@1     1@0   --                                            Back      1@7     2@5     1@4                                         CI                                                                            14      CI8       8@0     0       0     0                                     15      CI4       4@0     0       0     0                                     ______________________________________                                    

Overlays and Underlays

In a GUI system there are two possible relationships between the overlayplanes (or underlay) and the main planes.

The overlay planes are fixed to the main planes, so that if the windowis moved then both the data in the main planes and overlay planes movetogether.

The overlay planes are not fixed to the main planes but floating, sothat moving a window only moves the associated main or overlay planes.

In the fixed case both planes can share the same GID. The pixel offsetis used to redirect the reads and writes between the main planes and theoverlay (underlay) buffer. The pixel ownership tests using the GID fieldin the localbuffer work as expected.

In the floating case different GIDs are the best choice, because thesame GID planes in the localbuffer can not be used for pixel ownershiptests. The alternatives are not to use the GID based pixel ownershiptests for one of the buffers but rely on the scissor clipping, or toinstall a second set of GID planes so each buffer has it's own set.GLINT allows either approach.

If rendering operations to the main and overlay planes both need thedepth or stencil buffers, and the windows in each overlap then eachbuffer will need its own exclusive depth and/or stencil buffers. This iseasily achieved with GLINT by assigning different regions in thelocalbuffer to each of the buffers. Typically this would double thelocalbuffer memory requirements.

One scenario where the above two considerations do not cause problems,is when the overlay planes are used exclusively by the GUI system, andthe main planes are used for the 3D graphics.

VRAM Modes

High performance systems will typically use VRAM for the framebuffer andthe extended functionality of VRAM over DRAM can be used to enhanceperformance for many rendering tasks.

Hardware Write Masks.

These allow write masking in the framebuffer without incurring aperformance penalty. If hardware write masks are not available, GLINTmust be programmed to read the memory, merge the value with the newvalue using the write mask, and write it back.

To use hardware write masking, the required write mask is written to theFBHardwareWriteMask register, the FBSoftwareWriteMask register should beset to all 1's, and the number of framebuffer reads is set to 0 (fornormal rendering). This is achieved by clearing the ReadSource andReadDestination enables in the FBReadMode register.

To use software write masking, the required write mask is written to theFBSoftwareWriteMask register and the number of framebuffer reads is setto 1 (for normal rendering). This is achieved by setting theReadDestination enable in the FBReadMode register.

Block Writes

Block writes cause consecutive pixels in the framebuffer to be writtensimultaneously. This is useful when filling large areas but does havesome restrictions:

No pixel level clipping is available;

No depth or stencil testing can be done;

All the pixels must be written with the same value so no colorinterpolation, blending, dithering or logical ops can be done; and

The area is defined in screen relative coordinates.

Block writes are not restricted to rectangular areas and can be used forany trapezoid. Hardware write masking is available during block writes.

The following registers need to be set up before block fills can beused:

FBBlockColor register with the value to write to each pixel; and

FBWriteMode register with the block width field.

Sending a Render command with the PrimitiveType field set to "trapezoid"and the FastFillEnable and FastFillIncrement fields set up will thencause block filling of the area. Note that during a block fill of atrapezoid any inappropriate state is ignored so even if colorinterpolation, depth testing and logical ops, for example, are enabledthey have no effect.

The block sizes supported are 8, 16 and 32 pixels. GLINT takes care offilling any partial blocks at the end of spans.

Graphics Programming

GLINT provides a rich variety of operations for 2D and 3D graphicssupported by its Pipelined architecture.

The Graphics Pipeline

This section describes each of the units in the graphics Pipeline. FIG.2C shows a schematic of the pipeline. In this diagram, the localbuffercontains the pixel ownership values (known as Graphic IDs), theFrameCount Planes (FCP), Depth (Z) and Stencil buffer. The framebuffercontains the Red, Green, Blue and Alpha bitplanes. The operations in thePipeline include:

Rasterizer scan converts the given primitive into a series of fragmentsfor processing by the rest of the pipeline.

Scissor Test clips out fragments that lie outside the bounds of a userdefined scissor rectangle and also performs screen clipping to stopillegal access outside the screen memory.

Stipple Test masks out certain fragments according to a specifiedpattern. Line and area stipples are available.

Color DDA is responsible for generating the color information (TrueColor RGBA or Color Index(CD) associated with a fragment.

Texture is concerned with mapping a portion of a specified image(texture) onto a fragment. The process involves filtering to calculatethe texture color, and application which applies the texture color tothe fragment color.

Fog blends a fog color with a fragment's color according to a given fogfactor. Fogging is used for depth cuing images and to simulateatmospheric fogging.

Antialias Application combines the incoming fragment's alpha value withits coverage value when antialiasing is enabled.

Alpha Test conditionally discards a fragment based on the outcome of acomparison between the fragments alpha value and a reference alphavalue.

Pixel Ownership is concerned with ensuring that the location in theframebuffer for the current fragment is owned by the current visual.Comparison occurs between the given fragment and the Graphic ID value inthe localbuffer, at the corresponding location, to determine whether thefragment should be discarded.

Stencil Test conditionally discards a fragment based on the outcome of atest between the given fragment and the value in the stencil buffer atthe corresponding location. The stencil buffer is updated dependent onthe result of the stencil test and the depth test.

Depth Test conditionally discards a fragment based on the outcome of atest between the depth value for the given fragment and the value in thedepth buffer at the corresponding location. The result of the depth testcan be used to control the updating of the stencil buffer.

Alpha Blending combines the incoming fragment's color with the color inthe framebuffer at the corresponding location.

Color Formatting converts the fragment's color into the format in whichthe color information is stored in the framebuffer. This may optionallyinvolve dithering.

The Pipeline structure of GLINT is very efficient at processingfragments, for example, texture mapping calculations are not actuallyperformed on fragments that get clipped out by scissor testing. Thisapproach saves substantial computational effort. The pipelined naturedoes however mean that when programming GLINT one should be aware ofwhat all the pipeline stages are doing at any time. For example, manyoperations require both a read and/or write to the localbuffer andframebuffer; in this case it is not sufficient to set a logicaloperation to XOR and enable logical operations, but it is also necessaryto enable the reading/writing of data from/to the framebuffer.

A Gouraud Shaded Triangle

We may now revisit the "day in the life of a triangle" example givenabove, and review the actions taken in greater detail. Again, theprimitive being rendered will be a Gouraud shaded, depth bufferedtriangle. For this example assume that the triangle is to be drawn intoa window which has its colormap set for RGB as opposed to color indexoperation. This means that all three color components; red, green andblue, must be handled. Also, assume the coordinate origin is bottom leftof the window and drawing will be from top to bottom. GLINT can drawfrom top to bottom or bottom to top.

Consider a triangle with vertices, v₁, v₂ and v₃ where each vertexcomprises X, Y and Z coordinates. Each vertex has a different color madeup of red, green and blue (R, G and B) components. The alpha componentwill be omitted for this example.

Initialization

GLINT requires many of its registers to be initialized in a particularway, regardless of what is to be drawn, for instance, the screen sizeand appropriate clipping must be set up. Normally this only needs to bedone once and for clarity this example assumes that all initializationhas already been done.

Other state will change occasionally, though not usually on a perprimitive basis, for instance enabling Gouraud shading and depthbuffering.

Dominant and Subordinate Sides of a Triangle

As shown in FIG. 4A, the dominant side of a triangle is that with thegreatest range of Y values. The choice of dominant side is optional whenthe triangle is either flat bottomed or flat topped.

GLINT always draws triangles starting from the dominant edge towards thesubordinate edges. This simplifies the calculation of set up parametersas will be seen below.

These values allow the color of each fragment in the triangle to bedetermined by linear interpolation. For example, the red component colorvalue of a fragment at X_(n), Y_(m) could be calculated by:

adding dRdy₁₃, for each scanline between Y₁ and Y_(n), to R₁.

then adding dRdx for each fragment along scanline Y_(n) from the leftedge to X_(n).

The example chosen has the `knee,` i.e. vertex 2, on the right handside, and drawing is from left to right. If the knee were on the leftside (or drawing was from right to left), then the Y deltas for both thesubordinate sides would be needed to interpolate the start values foreach color component (and the depth value) on each scanline. For thisreason GLINT always draws triangles starting from the dominant edge andtowards the subordinate edges. For the example triangle, this means leftto right.

Register Set Up for Color Interpolation

For the example triangle, the GLINT registers must be set as follows,for color interpolation. Note that the format for color values is 24bit, fixed point 2's complement.

    ______________________________________                                        // Load the color start and delta values to draw                              // a triangle                                                                 RStart (R.sub.1)                                                              GStart (G.sub.1)                                                              BStart (B.sub.1)                                                              dRdyDom (dRdy.sub.13)  // To walk up the dominant edge                        dGdyDom (dGdy.sub.13)                                                         dBdyDom (dBdy.sub.13)                                                         dRdx (dRdx)      // To walk along the scanline                                dGdx (dGdx)                                                                   dBdx (dBdx)                                                                   ______________________________________                                    

Calculating Depth Gradient Values

To draw from left to right and top to bottom, the depth gradients (ordeltas) required for interpolation are: ##EQU1##

The divisor, shown here as c, is the same as for color gradient values.The two deltas dZdy₁₃ and dZdx allow the Z value of each fragment in thetriangle to be determined by linear interpolation, just as for the colorinterpolation.

Register Set Up for Depth Testing

Internally GLINT uses fixed point arithmetic. Each depth value must beconverted into a 2's complement 32.16 bit fixed point number and thenloaded into the appropriate pair of 32 bit registers. The `Upper` or `U`registers store the integer portion, whilst the `Lower` or `L` registersstore the 16 fractional bits, left justified and zero filled.

For the example triangle, GLINT would need its registers set up asfollows:

    ______________________________________                                               // Load the depth start and delta values                                      // to draw a triangle                                                         ZStartU (Z1.sub.-- MS)                                                        ZStartL (Z1.sub.-- LS)                                                        dZdyDomU (dZdy13.sub.-- MS)                                                   dZdyDomL (dZdy13.sub.-- LS)                                                   dZdxU (dZdx.sub.-- MS)                                                        dZdxL (dZdx.sub.-- LS)                                                 ______________________________________                                    

Calculating the Slopes for each Side

GLINT draws filled shapes such as triangles as a series of spans withone span per scanline. Therefore it needs to know the start and end Xcoordinate of each span. These are determined by `edge walking`. Thisprocess involves adding one delta value to the previous span's start Xcoordinate and another delta value to the previous span's end xcoordinate to determine the X coordinates of the new span. These deltavalues are in effect the slopes of the triangle sides. To draw from leftto right and top to bottom, the slopes of the three sides are calculatedas: ##EQU2##

This triangle will be drawn in two parts, top down to the `knee` (i.e.vertex 2), and then from there to the bottom. The dominant side is theleft side so for the top half:

    dXDom=dX.sub.13

    dXSub=dX.sub.12

The start X,Y, the number of scanlines, and the above deltas give GLINTenough information to edge walk the top half of the triangle. However,to indicate that this is not a flat topped triangle (GLINT is designedto rasterize screen aligned trapezoids and flat topped triangles), thesame start position in terms of X must be given twice as StartXDom andStartXSub.

To edge walk the lower half of the triangle, selected additionalinformation is required. The slope of the dominant edge remainsunchanged, but the subordinate edge slope needs to be set to:

    dXSub=dX.sub.23

Also the number of scanlines to be covered from Y₂ to Y₃ needs to begiven. Finally to avoid any rounding errors accumulated in edge walkingto X₂ (which can lead to pixel errors), StartXSub must be set to X₂.

Rasterizer Mode

The GLINT rasterizer has a number of modes which have effect from thetime they are set until they are modified and can thus affect manyprimitives. In the case of the Gouraud shaded triangle the default valuefor these modes are suitable.

Subpixel Correction

GLINT can perform subpixel correction of all interpolated values whenrendering aliased trapezoids. This correction ensures that any parameter(color/depth/texture/fog) is correctly sampled at the center of afragment. Subpixel correction will generally always be enabled whenrendering any trapezoid which is smooth shaded, textured, fogged ordepth buffered. Control of subpixel correction is in the Render commandregister described in the next section, and is selectable on a perprimitive basis.

Rasterization

GLINT is almost ready to draw the triangle. Setting up the registers asdescribed here and sending the Render command will cause the top half ofthe example triangle to be drawn.

For drawing the example triangle, all the bit fields within the Rendercommand should be set to 0 except the PrimitiveType which should be setto trapezoid and the SubPixelCorrectionEnable bit which should be set toTRUE.

    ______________________________________                                        // Draw triangle with knee                                                    // Set deltas                                                                 StartXDom (X.sub.1 <<16) // Converted to 16.16 fixed                          point                                                                         dXDom (((X.sub.3 - X.sub.1)<<16)/(Y.sub.3 - Y.sub.1))                         StartXSub (X.sub.1 <<16)                                                      dXSub (((X.sub.2 - X.sub.1)<<16)/(Y.sub.2 - Y.sub.1))                         StartY (Y.sub.1 <<16)                                                         dY (-1<<16)                                                                   Count (Y.sub.1 - Y.sub.2)                                                     // Set the render command mode                                                render.PrimitiveType = GLINT.sub.-- TRAPEZOID.sub.-- PRIMITIVE                render.SubPixelCorrectionEnable = TRUE                                        // Draw the top half of the triangle                                          Render(render)                                                                ______________________________________                                    

After the Render command has been issued, the registers in GLINT canimmediately be altered to draw the lower half of the triangle. Note thatonly two registers need be loaded and the command ContinueNewSub sent.Once GLINT has received ContinueNewSub, drawing of this sub-trianglewill begin.

    ______________________________________                                        // Setup the delta and start for the new edge                                 StartXSub (X.sub.2 <<16)                                                      dXSub (((X.sub.3 - X.sub.2)<<16)/(Y.sub.3 - Y.sub.2))                         // Draw sub-triangle                                                          ContinueNewSub (Y.sub.2 - Y.sub.3) // Draw lower half                         ______________________________________                                    

Rasterizer Unit

The rasterizer decomposes a given primitive into a series of fragmentsfor processing by the rest of the Pipeline.

GLINT can directly rasterize:

aliased screen aligned trapezoids

aliased single pixel wide lines

aliased single pixel points

antialiased screen aligned trapezoids

antialiased circular points

All other primitives are treated as one or more of the above, forexample an antialiased line is drawn as a series of antialiasedtrapezoids.

Trapezoids

GLINT's basic area primitives are screen aligned trapezoids. These arecharacterized by having top and bottom edges parallel to the X axis. Theside edges may be vertical (a rectangle), but in general will bediagonal. The top or bottom edges can degenerate into points in whichcase we are left with either flat topped or flat bottomed triangles. Anypolygon can be decomposed into screen aligned trapezoids or triangles.Usually, polygons are decomposed into triangles because theinterpolation of values over non-triangular polygons is ill defined. Therasterizer does handle flat topped and flat bottomed `bow tie` polygonswhich are a special case of screen aligned trapezoids. To render atriangle, the approach adopted to determine which fragments are to bedrawn is known as `edge walking`. Suppose the aliased triangle shown inFIG. 4A was to be rendered from top to bottom and the origin was bottomleft of the window. Starting at (X1, Y1) then decrementing Y and usingthe slope equations for edges 1-2 and 1-3, the intersection of each edgeon each scanline can be calculated. This results in a span of fragmentsper scanline for the top trapezoid. The same method can be used for thebottom trapezoid using slopes 2-3 and 1-3.

It is usually required that adjacent triangles or polygons which sharean edge or vertex are drawn such that pixels which make up the edge orvertex get drawn exactly once. This may be achieved by omitting thepixels down the left or the right sides and the pixels along the top orlower sides. GLINT has adopted the convention of omitting the pixelsdown the right hand edge. Control of whether the pixels along the top orlower sides are omitted depends on the start Y value and the number ofscanlines to be covered. With the example, if StartY=Y1 and the numberof scanlines is set to Y1-Y2, the lower edge of the top half of thetriangle will be excluded. This excluded edge will get drawn as part ofthe lower half of the triangle.

To minimize delta calculations, triangles may be scan converted fromleft to right or from right to left. The direction depends on thedominant edge, that is the edge which has the maximum range of Y values.Rendering always proceeds from the dominant edge towards the relevantsubordinate edge. In the example above, the dominant edge is 1-3 sorendering will be from right to left.

The sequence of actions required to render a triangle (with a `knee`)is:

Load the edge parameters and derivatives for the dominant edge and thefirst subordinate edges in the first triangle.

Send the Render command. This starts the scan conversion of the firsttriangle, working from the dominant edge. This means that for triangleswhere the knee is on the left we are scanning right to left, and viceversa for triangles where the knee is on the right.

Load the edge parameters and derivatives for the remaining subordinateedge in the second triangle.

Send the ContinueNewSub command. This starts the scan conversion of thesecond triangle.

Pseudocode for the above example is:

    ______________________________________                                        // Set the rasterizer mode to the default                                     RasterizerMode(0)                                                             // Setup the start values and the deltas.                                     // Note that the X and Y coordinates are converted                            // to 16.16 format                                                            StartXDom (X1<<16)                                                            dXDom (((X3- X1)<<16)/(Y3 - Y1))                                              StartXSub (X1<<16)                                                            dXSub (((X2- X1)<<16)/(Y2 - Y1))                                              StartY (Y1<<16)                                                               dY (-1<<16)         // Down the screen                                        Count (Y1 - Y2)                                                               // Set the render mode to aliased primitive with                              // subpixel correction.                                                       render.PrimitiveType = GLINT.sub.-- TRAPEZOID.sub.-- PRIMITIVE                render.SubpixelCorrectionEnable = GLINT.sub.-- TRUE                           render.AntialiasEnable = GLINT.sub.-- DISABLE                                 // Draw top half of the triangle                                              Render(render)                                                                // Set the start and delta for the second half of                             // the triangle.                                                              StartXSub (X2<<16)                                                            dXSub (((X3- X2)<<16)/(Y3 - Y2))                                              // Draw lower half of triangle                                                ContinueNewSub (abs(Y2 - Y3))                                                 ______________________________________                                    

After the Render command has been sent, the registers in GLINT canimmediately be altered to draw the second half of the triangle. Forthis, note that only two registers need be loaded and the commandContinueNewSub be sent. Once drawing of the first triangle is completeand GLINT has received the ContinueNewSub command, drawing of thissub-triangle will start. The ContinueNewSub command register is loadedwith the remaining number of scanlines to be rendered.

Lines

Single pixel wide aliased lines are drawn using a DDA algorithm, so allGLINT needs by way of input data is StartX, StartY, dX, dY and length.

For polylines, a ContinueNewLine command (analogous to the Continuecommand used at the knee of a triangle) is used at vertices.

When a Continue command is issued some error will be propagated alongthe line. To minimize this, a choice of actions are available as to howthe DDA units are restarted on the receipt of a Continue command. It isrecommended that for OpenGL rendering the ContinueNewLine command is notused and individual segments are rendered.

Antialiased lines, of any width, are rendered as antialiasedscreen-aligned trapezoids.

Points

GLINT supports a single pixel aliased point primitive. For points largerthan one pixel trapezoids should be used. In this case the PrimitiveTypefield in the Render command should be set to equal GLINT₋₋ POINT₋₋PRIMITIVE.

Antialiasing

GLINT uses a subpixel point sampling algorithm to antialias primitives.GLINT can directly rasterize antialiased trapezoids and points. Otherprimitives are composed from these base primitives.

The rasterizer associates a coverage value with each fragment producedwhen antialiasing. This value represents the percentage coverage of thepixel by the fragment. GLINT supports two levels of antialiasingquality:

normal, which represents 4×4 pixel subsampling

high, which represents 8×8 pixel subsampling.

Selection between these two is made by the AntialiasingQuality bitwithin the Render command register.

When rendering antialiased primitives with GLINT the FlushSpan commandis used to terminate rendering of a primitive. This is due to the natureof GLINT antialiasing. When a primitive is rendered which does nothappen to complete on a scanline boundary, GLINT retains antialiasinginformation about the last sub-scanline(s) it has processed, but doesnot generate fragments for them unless a FlushSpan command is received.The commands ContinueNewSub, ContinueNewDom or Continue can then beused, as appropriate, to maintain continuity between adjacenttrapezoids. This allows complex antialiased primitives to be built upfrom simple trapezoids or points.

To illustrate this consider using screen aligned trapezoids to render anantialiased line. The line will in general consist of three screenaligned trapezoids as shown in FIG. 4B. This Figure illustrates thesequence of rendering an Antialiased Line primitive. Note that the linehas finite width.

The procedure to render the line is as follows:

    ______________________________________                                        // Setup the blend and coverage application units                             // as appropriate - not shown                                                 // In this example only the edge deltas are shown                             // loaded into registers for clarity.  In reality                             // start X and Y values are required                                          // Render Trapezoid A                                                         dY(1<<16)                                                                     dXDom(dXDom1<<16)                                                             dxSub(dXSub1<<16)                                                             Count(count1)                                                                 render.PrimitiveType = GLINT.sub.-- TRAPEZOID                                 render.AntialiasEnable = GLINT.sub.-- TRUE                                    render.AntialiasQuality = GLINT.sub.-- MIN.sub.-- ANTIALIAS                   render.CoverageEnable = GLINT.sub.-- TRUE                                     Render(render)                                                                // Render Trapezoid B                                                         dXSub(dXSub2<<16)                                                             ContinueNewSub(count2)                                                        // Render Trapezoid C                                                         dXDom(dXDom2<<16)                                                             ContinueNewDom(count3)                                                        // Now we have finished the primitive flush out                               // the last scanline                                                          FlushSpan()                                                                   ______________________________________                                    

Note that when rendering antialiased primitives, any count values shouldbe given in subscanlines, for example if the quality is 4×4 then anyscanline count must be multiplied by 4 to convert it into a subscanlinecount. Similarly, any delta value must be divided by 4.

When rendering, AntialiasEnable must be set in the AntialiasModeregister to scale the fragments color by the coverage value. Anappropriate blending function should also be enabled.

Note, when rendering antialiased bow-ties, the coverage value on thecross-over scanline may be incorrect.

GLINT can render small antialiased points. Antialiased points aretreated as circles, with the coverage of the boundary fragments rangingfrom 0% to 100%. GLINT supports:

point radii of 0.5 to 16.0 in steps of 0.25 for 4×4 antialiasing

point radii of 0.25 to 8.0 in steps of 0.125 for 8×8 antialiasing

To scan convert an antialiased point as a circle, GLINT traverses theboundary in sub scanline steps to calculate the coverage value. Forthis, the sub-scanline intersections are calculated incrementally usinga small table. The table holds the change in X for a step in Y. Symmetryis used so the table only holds the delta values for one quadrant.

StartXDom, StartXSub and StartY are set to the top or bottom of thecircle and dY set to the subscanline step. In the case of an evendiameter, the last of the required entries in the table is set to zero.

Since the table is configurable, point shapes other than circles can berendered. Also if the StartXDom and StartXSub values are not coincidentthen horizontal thick lines with rounded ends, can be rendered.

Block Write Operation

GLINT supports VRAM block writes with block sizes of 8, 16 and 32pixels. The block write method does have some restrictions: None of theper pixel clipping, stipple, or fragment operations are available withthe exception of write masks. One subtle restriction is that the blockcoordinates will be interpreted as screen relative and not windowrelative when the pixel mask is calculated in the Framebuffer Units.

Any screen aligned trapezoid can be filled using block writes, not justrectangles.

The use of block writes is enabled by setting the FastFillEnable andFastFillIncrement fields in the Render command register. The framebufferwrite unit must also be configured.

Note only the Rasterizer, Framebuffer Read and Framebuffer Write unitsare involved in block filling. The other units will ignore block writefragments, so it is not necessary to disable them.

Sub Pixel Precision and Correction

As the rasterizer has 16 bits of fraction precision, and the screenwidth used is typically less than 2¹⁶ wide a number of bits calledsubpixel precision bits, are available. Consider a screen width of 4096pixels. This figure gives a subpixel precision of 4 bits (4096=2¹²). Theextra bits are required for a number of reasons:

antialiasing (where vertex start positions can be supplied to subpixelprecision)

when using an accumulation buffer (where scans are rendered multipletimes with jittered input vertices)

for correct interpolation of parameters to give high quality shading asdescribed below

GLINT supports subpixel correction of interpolated values when renderingaliased trapezoids. Subpixel correction ensures that all interpolatedparameters associated with a fragment (color, depth, fog, texture) arecorrectly sampled at the fragment's center. This correction is requiredto ensure consistent shading of objects made from many primitives. Itshould generally be enabled for all aliased rendering which usesinterpolated parameters.

Subpixel correction is not applied to antialiased primitives.

Bitmaps

A Bitmap primitive is a trapezoid or line of ones and zeros whichcontrol which fragments are generated by the rasterizer. Only fragmentswhere the corresponding Bitmap bit is set are submitted for drawing. Thenormal use for this is in drawing characters, although the mechanism isavailable for all primitives. The Bitmap data is packed contiguouslyinto 32 bit words so that rows are packed adjacent to each other. Bitsin the mask word are by default used from the least significant endtowards the most significant end and are applied to pixels in the orderthey are generated in.

The rasterizer scans through the bits in each word of the Bitmap dataand increments the X,Y coordinates to trace out the rectangle of thegiven width and height. By default, any set bits (1) in the Bitmap causea fragment to be generated, any reset bits (0) cause the fragment to berejected.

The selection of bits from the BitMaskPattern register can be mirrored,that is, the pattern is traversed from MSB to LSB rather than LSB toMSB. Also, the sense of the test can be reversed such that a set bitcauses a fragment to be rejected and vice versa. This control is foundin the RasterizerMode register.

When one Bitmap word has been exhausted and pixels in the rectanglestill remain then rasterization is suspended until the next write to theBitMaskPattern register. Any unused bits in the last Bitmap word arediscarded.

Image Copy/Upload/Download

GLINT supports three "pixel rectangle" operations: copy, upload anddownload. These can apply to the Depth or Stencil Buffers (held withinthe localbuffer) or the framebuffer.

It should be emphasized that the GLINT copy operation moves RAW blocksof data around buffers. To zoom or re-format data, in the presentlypreferred embodiment, external software must upload the data, process itand then download it again.

To copy a rectangular area, the rasterizer would be configured to renderthe destination rectangle, thus generating fragments for the area to becopied. GLINT copy works by adding a linear offset to the destinationfragment's address to find the source fragment's address.

Note that the offset is independent of the origin of the buffer orwindow, as it is added to the destination address. Care must be takenwhen the source and destination overlap to choose the source scanningdirection so that the overlapping area is not overwritten before it hasbeen moved. This may be done by swapping the values written to theStartXDom and StartXSub, or by changing the sign of dY and settingStartY to be the opposite side of the rectangle.

Localbuffer copy operations are correctly tested for pixel ownership.Note that this implies two reads of the localbuffer, one to collect thesource data, and one to get the destination GID for the pixel ownershiptest.

GLINT buffer upload/downloads are very similar to copies in that theregion of interest is generated in the rasterizer. However, thelocalbuffer and framebuffer are generally configured to read or to writeonly, rather than both read and write. The exception is that an imageload may use pixel ownership tests, in which case the localbufferdestination read must be enabled.

Units which can generate fragment values, the color DDA unit forexample, should generally be disabled for any copy/upload/downloadoperations.

Warning: During image upload, all the returned fragments must be readfrom the Host Out FIFO, otherwise the GLINT pipeline will stall. Inaddition it is strongly recommended that any units which can discardfragments (for instance the following tests: bitmask, alpha, userscissor, screen scissor, stipple, pixel ownership, depth, stencil), aredisabled otherwise a shortfall in pixels returned may occur, alsoleading to deadlock.

Note that because the area of interest in copy/upload/downloadoperations is defined by the rasterizer, it is not limited torectangular regions.

Color formatting can be used when performing image copies, uploads anddownloads. This allows data to be formatted from, or to, any of thesupported GLINT color formats.

Rasterizer Mode

A number of long-term modes can be set using the Rasterizer-Moderegister, these are:

Mirror BitMask

This is a single bit flag which specifies the direction bits are checkedin the BitMask register. If the bit is reset, the direction is fromleast significant to most significant (bit 0 to bit 31), if the bit isset, it is from most significant to least significant (from bit 31 tobit 0).

Invert BitMask

This is a single bit which controls the sense of the accept/reject testwhen using a Bitmask. If the bit is reset then when the BitMask bit isset the fragment is accepted and when it is reset the fragment isrejected. When the bit is set the sense of the test is reversed.

Fraction Adjust

These 2 bits control the action taken by the rasterizer on receiving aContinueNewLine command. As GLINT uses a DDA algorithm to render lines,an error accumulates in the DDA value. GLINT provides for greatercontrol of the error by doing one of the following:

leaving the DDA running, which means errors will be propagated along aline.

or setting the fraction bits to either zero, a half or almost a half(0×7FFF).

Bias Coordinates

Only the integer portion of the values in the DDAs are used to generatefragment addresses. Often the actual action required is a rounding ofvalues, this can be achieved by setting the bias coordinate bit to truewhich will automatically add almost a half (0×7FFF) to all inputcoordinates.

Rasterizer Unit Registers Real coordinates with fractional parts areprovided to the rasterizer in 2's complement 16 bit integer, 16 bitfraction format. The following Table lists the command registers whichcontrol the rasterizer unit:

    ______________________________________                                        Register Name                                                                            Description                                                        ______________________________________                                        Render     Starts the rasterization process                                   ContinueNewDom                                                                           Allows the rasterization to continue with a new                               dominant edge. The dominant edge DDA is reloaded                              with the new parameters. The subordinate edge is                              carried on from the previous trapezoid. This allows                           any convex polygon to be broken down into a                                   collection of trapezoids, with continuity maintained                          across boundaries.                                                            The data field holds the number of scanlines (or sub                          scanlines) to fill. Note this count does not get loaded                       into the Count register.                                           ContinueNewSub                                                                           Allows the rasterization to continue with a new                               subordinate edge. The subordinate DDA is reloaded                             with the new parameters. The dominant edge is                                 carried on from the previous trapezoid. This is                               useful when scan converting triangles with a `knee`                           (i.e. two subordinate edges).                                                 The data field holds the number of scanlines (or sub                          scanlines) to fill. Note this count does not get loaded                       into the Count register.                                           Continue   Allows the rasterization to continue after new delta                          value(s) have been loaded, but does not cause either                          of the trapezoid's edge DDAs to be reloaded.                                  The data field holds the number of scanlines (or sub                          scanlines) to fill. Note this count does not get loaded                       into the Count register.                                           ContinueNewLine                                                                          Allows the rasterization to continue for the next                             segment in a polyline. The XY position is carried on                          from the previous line, but the fraction bits in the                          DDAs can be: kept, set to zero, half, or nearly one                           half, tinder control of the RasterizerMode.                                   The data field holds the number of scanlines to fill.                         Note this count does not get loaded into the Count                            register. The use of ContinueNewLine is not                                   recommended for OpenGL because the DDA units                                  will start with a slight error as compared with                               the value they would have been loaded with for the                            second and subsequent segments.                                    Flushspan  Used when antialiasing to force the last span out                             when not all sub spans may be defined.                             ______________________________________                                    

    ______________________________________                                                  Defines the long term mode of operation of the                      RasterizerMode                                                                          rasterizer.                                                         ______________________________________                                        StartXDom Initia1 X value for the dominant edge in trapezoid                            filling, or initial X value in line drawing.                        dXDom     Value added when moving from one scanline (or sub                             scanline) to the next for the dominant edge in                                trapezoid filling. Also holds the change in X when                            plotting lines so for Y major lines this will be some                         fraction (dx/dy), otherwise it is normally ± 1.0,                          depending on the required scanning direction.                       StartXSub Initial X value for the subordinate edge.                           dXSub     Value added when moving from one scaniine (or sub                             scanline) to the next for the subordinate edge in                             trapezoid filling.                                                  StartY    Initial scanline (or sub scanline) in trapezoid filling, or                   initial Y position for line drawing.                                dY        Value added to Y to move from one scanline to the                             next. For X major lines this will be some fraction                            (dy/dx), otherwise it is normally ± 1.0, depending on                      the required scanning direction.                                    Count     Number of pixels in a line.                                                   Number of scanlines in a trapezoid.                                           Number of sub scanlines in an antialiased trapezoid.                          Diameter of a point in sub scanlines.                               BitMaskPattern                                                                          Value used to control the BitMask stipple operation (if                       enabled).                                                           PointTable0                                                                             Antialias point data table. There are 4 words in the                PointTable1                                                                             table and the register tag is decoded to select a word.             PointTable2                                                                   PointTable3                                                                   ______________________________________                                    

For efficiency, the Render command register has a number of bit fieldsthat can be set or cleared per render operation, and which qualify otherstate information within GLINT. These bits are AreaStippleEnable,LineStippleEnable, ResetLineStipple, TextureEnable FogEnable,CoverageEnable and SubpixelCorrection.

One use of this feature can occur when a window is cleared to abackground color. For normal 3D primitives, stippling and fog operationsmay have been enabled, but these are to be ignored for window clears.Initially the FogMode, AreaStippleMode and LineStippleMode registers areenabled through the UnitEnable bits. Now bits need only be set orcleared within the Render command to achieve the required result,removing the need for the FogMode, AreaStippleMode and LineStippleModeregisters to be loaded for every render operation.

The bitfields of the Render command register, in the presently preferredembodiment, are detailed below:

    __________________________________________________________________________    Bit                                                                              Name   Description                                                         __________________________________________________________________________    0  Area-  This bit, when set, enables area stippling of the fragments            Stipple-                                                                             produced during rasterization. Note that area stipple in the           Enable Stipple Unit must be enabled as well for stippling to occur.                  When this bit is reset no area stippling occurs irrespective                  of                                                                            the setting of the area stipple enable bit in the Stipple                     Unit.                                                                         This bit is useful to temporarily force no area stippling for                 this                                                                          primitive.                                                          1  Line-  This bit, when set, enables line stippling of the fragments            Stipple-                                                                             produced during rasterization in the Stipple Unit. Note that           Enable line stipple in the Stipple Unit must be enabled as well for                  stip-                                                                         pling to occur.                                                               When this bit is reset no line stippling occurs irrespective                  of                                                                            the setting of the line stipple enable bit in the Stipple                     Unit.                                                                         This bit is useful to temporarily force no line stippling for                 this                                                                          primitive.                                                          2  Reset- This bit, when set, causes the line stipple counters in the            Line-  Stipple Unit to be reset to zero, and would typically be used          Stipple                                                                              for the first segment in a polyline. This action is also                      qualified.                                                                    by the LineStippleEnable bit and also the stipple enable bits                 in                                                                            the Stipple Unit.                                                             When this bit is reset the stipple counters carry on from                     where                                                                         they left off (if line stippling is enabled)                        3  FastFillEnable                                                                       This bit, when set, causes fast block filling of primitives.                  When this bit is reset the normal rasterization process                       occurs.                                                             4,5                                                                              Fast-Fill-                                                                           This two bit field selects the block size the framebuffer              Increment                                                                            supports. The sizes supported and the corresponding codes.                    are:                                                                          0 = 8 pixels                                                                  1 = 16 pixels                                                                 2 = 32 pixels                                                       6,7                                                                              Primitive-                                                                           This two bit field selects the primitive type to rasterize.                   The                                                                    Type   primitives are:                                                               0 = Line                                                                      1 = Trapezoid                                                                 2 = Point                                                           8  Antialias-                                                                           This bit, when set, causes the generation of sub scanline data         Enable and the coverage value to be calculated for each fragment.                    The number of sub pixel samples to use is controlled by the                   AntialiasingQuality bit.                                                      When this bit is reset normal rasterization occurs.                 9  An-    This bit, when set, sets the sub pixel resolution to be                       8×8                                                              tialiasing-                                                                          When this bit is reset the sub pixel resolution is 4×4.          Quality                                                                    10 UsePoint-                                                                            When this bit and the AntialiasingEnable are set, the dx                      values                                                                 Table  used to move from one scanline to the next are derived from                   the Point Table.                                                    11 SyncOn-                                                                              This bit, when set; causes a number of actions:                        BitMask                                                                              The least significant bit or most significant bit (depending                  on                                                                            the MirrorBitMask bit) in the Bit Mask register is extracted                  and optionally inverted (controlled by the InvertBitMask bit).                If this bit is 0 then the corresponding fragment is culled                    from                                                                          being drawn.                                                                  After every fragment the Bit Mask register is rotated by one                  bit.                                                                          If all the bits in the Bit Mask register have been used then                  rasterization is suspended until a new BitMaskPattern is                      received. If any other register is written while the                          rasterization                                                                 is suspended then the rasterization is aborted. The register                  write which caused the abort is then processed as normal.                     Note the behavior is slightly different when the Syn-                         cOnHostData bit is set to prevent a deadlock from occurring.                  In this case the rasterization doesn't suspend when all the                   bits                                                                          have been used and if new BitMaskPattern data words are not                   received in a timely manner then the subsequent fragments will                just reuse the bitmask.                                             12 SyncOn When this bit is set a fragment is produced only when one of                  HostData the following registers has been written by the host:                Depth,                                                                        FBColor, Stencil or Color. If SyncOnBitMask is reset, then if                 any register other than one of these four is written to, the                  rasterization is aborted. If SyncOnBitMask is set, then if any                register other than one of these four, or BitMaskPattern, is                  written to, the rasterization is aborted. The register write                  which caused the abort is then processed as normal. Writing to                the BitMaskPattern register doesn't cause any fragments to be                 generated, but just updates the BitMask register.                   13 TextureEnable                                                                        This bit, when set, enables texturing of the fragments                        produced                                                                      during rasterization. Note that the Texture Units must be                     suitably enabled as well for any texturing to occur.                          When this bit is reset no texturing occurs irrespective of the                setting of the Texture Unit controls.                                         This bit is useful to temporarily force no texturing for this                 primitive.                                                          14 Fog-   This bit, when set, enables fogging of the fragments produced          Enable during rasterization. Note that the Fog Unit must be suitably                 enabled as we11 for any fogging to occur.                                     When this bit is reset no fogging occurs irrespective of the                  setting of the Fog Unit controls.                                             This bit is useful to temporarily force no fogging for this                   primitive.                                                          15 Coverage-                                                                            This bit, when set, enables the coverage value produced as                    part                                                                   Enable of the antialiasing to weight the alpha value in the alpha                    test                                                                          unit. Note that this unit must be suitably enabled as well.                   When this bit is reset no coverage application occurs                         irrespec-                                                                     tive of the setting of the AntialiasMode in ihe Alpha Test                    unit.                                                               16 SubPixel-                                                                            This bit, when set enables the sub pixel correction of the                    color,                                                                 Correc-                                                                              depth, fog and texture values at the start of a scanline. When         tion   this bit is reset no correction is done at the start of a                     scanline.                                                              Enable Sub pixel corrections are only applied to aliased                   __________________________________________________________________________              trapezoids.                                                     

A number of long-term rasterizer modes are stored in the RasterizerModeregister as shown below:

    __________________________________________________________________________    Bit                                                                              Name Description                                                           __________________________________________________________________________    0  Mirror-                                                                            When this bit is set the bitmask bits are consumed from                  BitMask                                                                            the most significant end towards the least significant end.                   When this bit is reset the bitmask bits are consumed from                     the least significant end towards the most significant end.           1  InvertBit-                                                                         When this bit is set the bitmask is inverted first before                Mask being tested.                                                         2,3                                                                              Fraction-                                                                          These bits control the action of a ContinueNewLine com-                  Adjust                                                                             mand and specify how the fraction bits in the Y and XDom                      DDAs are adjusted                                                             0: No adjustment is done                                                      1: Set the fraction bits to zero                                              2: Set the fraction bits to half                                              3: Set the fraction to nearly half, i.e. 0x7fff                       4,5                                                                              BiasCoor-                                                                          These bits control how much isadded onto the                             dinates                                                                            StartxDom, StartXSub and StartY values when they are                          loaded into the DDA units. The original registers are not                     affected:                                                                     0: Zero is added                                                              1: Half is added                                                              2: Nearly half, i.e. 0x7fff is added                                  __________________________________________________________________________

Scissor Unit

Two scissor tests are provided in GLINT, the User Scissor test and theScreen Scissor test. The user scissor checks each fragment against auser supplied scissor region; the screen scissor checks that thefragment lies within the screen.

This test may reject fragments if some part of a window has been movedoff the screen. It will not reject fragments if part of a window issimply overlapped by another window (GID testing can be used to detectthis).

Stipple Unit Stippling is a process whereby each fragment is checkedagainst a bit in a defined pattern, and is rejected or accepteddepending on the result of the stipple test. If it is rejected itundergoes no further processing; otherwise it proceeds down thepipeline. GLINT supports two types of stippling, line and area.

Area Stippling

A 32×32 bit area stipple pattern can be applied to fragments. The leastsignificant n bits of the fragment's (X,Y) coordinates, index into a 2Dstipple pattern. If the selected bit in the pattern is set, then thefragment passes the test, otherwise it is rejected. The number ofaddress bits used, allow regions of 1,2,4,8,16 and 32 pixels to bestippled. The address selection can be controlled independently in the Xand Y directions. In addition the bit pattern can be inverted ormirrored. Inverting the bit pattern has the effect of changing the senseof the accept/reject test. If the mirror bit is set the most significantbit of the pattern is towards the left of the window, the default is theconverse.

In some situations window relative stippling is required but coordinatesare only available screen relative. To allow window relative stippling,an offset is available which is added to the coordinates before indexingthe stipple table. X and Y offsets can be controlled independently.

Line Stippling

In this test, fragments are conditionally rejected on the outcome oftesting a linear stipple mask. If the bit is zero then the test fails,otherwise it passes. The line stipple pattern is 16 bits in length andis scaled by a repeat factor r (in the range 1 to 512). The stipple maskbit b which controls the acceptance or rejection of a fragment isdetermined using:

    b=(floor (s/r)) mod 16

where s is the stipple counter which is incremented for every fragment(normally along the line). This counter may be reset at the start of apolyline, but between segments it continues as if there were no break.

The stipple pattern can be optionally mirrored, that is the bit patternis traversed from most significant to least significant bits, ratherthan the default, from least significant to most significant.

Color DDA Unit

The color DDA unit is used to associate a color with a fragment producedby the rasterizer. This unit should be enabled for rendering operationsand disabled for pixel rectangle operations (i.e. copies, uploads anddownloads). Two color modes are supported by GLINT, true color RGBA andcolor index (CI).

Gouraud Shading

When in Gouraud shading mode, the color DDA unit performs linearinterpolation given a set of start and increment values. Clamping isused to ensure that the interpolated value does not underflow oroverflow the permitted color range.

For a Gouraud shaded trapezoid, GLINT interpolates from the dominantedge of a trapezoid to the subordinate edges. This means that twoincrement values are required per color component, one to move along thedominant edge and one to move across the span to the subordinate edge.

Note that if one is rendering to multiple buffers and has initializedthe staff and increment values in the color DDA unit, then anysubsequent Render command will cause the start values to be reloaded.

If subpixel correction has been enabled for a primitive, then anycorrection required will be applied to the color components.

Flat Shading

In flat shading mode, a constant color is associated with each fragment.This color is loaded into the ConstantColor register.

Texture Unit

The texture unit combines the incoming fragment's color (generated inthe color DDA unit) with a value derived from interpolating texture mapvalues (texels).

Texture application consists of two stages; derivation of the texturecolor from the texels (a filtering process) and then application of thetexture color to the fragment's color, which is dependent on theapplication mode (Decal, Blend or Modulate).

GLINT 300SX compared with the GLINT 400TX

Both the GLINT 300SX and GLINT 400TX support all the filtering andapplication modes described in this section. However, when using theGLINT 300SX, texel values, interpolants and texture filter selectionsare supplied by the host. This implies that texture coordinateinterpolation and texel extraction are performed by the host usingtexture maps resident on the host. The recommended technique forperforming texture mapping using the GLINT 300SX is to scan convertprimitives on the host and render fragments as GLINT point primitives.

The GLINT 400TX automatically generates all data required for textureapplication as textures are stored in the localbuffer and textureparameter interpolation with full perspective correction takes placewithin the processor. Thus the GLINT 400TX is the processor of choicewhen full texture mapping acceleration is desired, the GLINT 300SX ismore suitable in applications where the performance of texture mappingis not critical.

Texture Color Generation.

Texture color generation supports all the filter modes of OpenGL, thatis:

    ______________________________________                                        Minification:     Nearest                                                                       Linear                                                                        NearestMipMapNearest                                                          NearestMipMapLinear                                                           LinearMipMapNearest                                                           LinearMipMapLinear                                          Magnification:    Nearest                                                                       Linear                                                      ______________________________________                                    

Minification is the name given to the filtering process used wherebymultiple texels map to a fragment, while magnification is the name givento the filtering process whereby only a portion of a single texel mapsto a single fragment.

Nearest is the simplest form of texture mapping where the nearest texelto the sample location is selected with no filtering applied.

Linear is a more sophisticated algorithm which is dependent on the typeof primitive. For lines (which are 1D), it involves linear interpolationbetween the two nearest texels, for polygons and points which areconsidered to have finite area, linear is in fact bi-linearinterpolation which interpolates between the nearest 4 texels.

Mip Mapping is a technique to allow the efficient filtering of texturemaps when the projected area of the fragment covers more than one texel(i.e. minification). A hierarchy of texture maps is held with each onebeing half the size (or one quarter the area) of the preceding one. Apair of maps are selected, based on the projected area of the texture.In terms of filtering this means that three filter operations areperformed: one on the first map, one on the second map and one betweenthe maps. The first filter name (Nearest or Linear) in the MipMap namespecifies the filtering to do on the two maps, and the second filtername specifies the filtering to do between maps. So for instance, linearmapping between two maps, with linear interpolation between the resultsis supported (LinearMipMapLinear), but linear interpolation on one map,nearest on the other map, and linear interpolation between the two isnot supported.

The filtering process takes a number of texels and interpolants, andwith the current texture filter mode produces a texture color.

Fog Unit

The fog unit is used to blend the incoming fragment's color (generatedby the color DDA unit, and potentially modified by the texture unit)with a predefined fog color. Fogging can be used to simulate atmosphericfogging, and also to depth cue images.

Fog application has two stages; derivation of the fog index for afragment, and application of the fogging effect. The fog index is avalue which is interpolated over the primitive using a DDA in the sameway color and depth are interpolated. The fogging effect is applied toeach fragment using one of the equations described below.

Note that although the fog values are linearly interpolated over aprimitive the fog values can be calculated on the host using a linearfog function (typically for simple fog effects and depth cuing) or amore complex function to model atmospheric attenuation. This wouldtypically be an exponential function.

Fog Index Calculation--The Fog DDA

The fog DDA is used to interpolate the fog index (f) across a primitive.The mechanics are similar to those of the other DDA units, andhorizontal scanning proceeds from dominant to subordinate edge asdiscussed above.

The DDA has an internal range of approximately +511 to -512, so in somecases primitives may exceed these bounds. This problem typically occursfor very large polygons which span the whole depth of a scene. Thecorrect solution is to tessellate the polygon until polygons lie withinthe acceptable range, but the visual effect is frequently negligible andcan often be ignored.

The fog DDA calculates a fog index value which is clamped to lie in therange 0.0 to 1.0 before it is used in the appropriate fogging equation.(Fogging is applied differently depending on the color mode.)

Antialias Application Unit

Antialias application controls the combining of the coverage valuegenerated by the rasterizer with the color generated in the color DDAunits. The application depends on the color mode, either RGBA or ColorIndex (CI).

Antialias Application

When antialiasing is enabled this unit is used to combine the coveragevalue calculated for each fragment with the fragment's alpha value. InRGBA mode the alpha value is multiplied by the coverage value calculatedin the rasterizer (its range is 0% to 100%). The RGB values remainunchanged and these are modified later in the Alpha Blend unit whichmust be set up appropriately. In CI mode the coverage value is placed inthe lower 4 bits of the color field. The Color Look Up Table is assumedto be set up such that each color has 16 intensities associated with it,one per coverage entry.

Polygon Antialiasing

When using GLINT to render antialiased polygons, depth buffering cannotbe used. This is because the order the fragments are combined in iscritical in producing the correct final color. Polygons should thereforebe depth sorted, and rendered front to back, using the alpha blendmodes: SourceAlphaSaturate for the source blend function and One for thedestination blend function. In this way the alpha component of afragment represents the percentage pixel coverage, and the blendfunction accumulates coverage until the value in the alpha buffer equalsone, at which point no further contributions can made to a pixel.

For the antialiasing of general scenes, with no restrictions onrendering order, the accumulation buffer is the preferred choice. Thisis indirectly supported by GLINT via image uploading and downloading,with the accumulation buffer residing on the host.

When antialiasing, interpolated parameters which are sampled within afragment (color, fog and texture), will sometimes be unrepresentative ofa continuous sampling of a surface, and care should be taken whenrendering smooth shaded antialiased primitives. This problem does notoccur in aliased rendering, as the sample point is consistently at thecenter of a pixel.

Alpha Test Unit

The alpha test compares a fragment's alpha value with a reference value.Alpha testing is not available in color index (CI) mode. The alpha testconditionally rejects a fragment based on the comparison between areference alpha value and one associated with the fragment.

Localbuffer Read/Write Unit

The localbuffer holds the Graphic ID, FrameCount, Stencil and Depth dataassociated with a fragment. The localbuffer read/write unit controls theoperation of GID testing, depth testing and stencil testing.

Localbuffer Read

The LBReadMode register can be configured to make 0, 1 or 2 reads of thelocalbuffer. The following are the most common modes of access to thelocalbuffer:

Normal rendering without depth, stencil or GID testing. This requires nolocalbuffer reads or writes.

Normal rendering without depth or stencil testing and with GID testing.This requires a localbuffer read to get the GID from the localbuffer.

Normal rendering with depth and/or stencil testing required whichconditionally requires the localbuffer to be updated. This requireslocalbuffer reads and writes to be enabled.

Copy operations. Operations which copy all or part of the localbufferwith or without GID testing. This requires reads and writes enabled.

Image upload/download operations. Operations which download depth orstencil information to the local buffer or read depth, stencil fastclear or GID from the localbuffer.

Localbuffer Write

Writes to the localbuffer must be enabled to allow any update of thelocalbuffer to take place. The LBWriteMode register is a single bit flagwhich controls updating of the buffer.

Pixel Ownership (GID) Test Unit

Any fragment generated by the rasterizer may undergo a pixel ownershiptest. This test establishes the current fragment's write permission tothe localbuffer and framebuffer.

Pixel Ownership Test

The ownership of a pixel is established by testing the GID of thecurrent window against the GID of a fragment's destination in the GIDbuffer. If the test passes, then a write can take place, otherwise thewrite is discarded. The sense of the test can be set to one of: alwayspass, always fail, pass if equal, or pass if not equal. Pass if equal isthe normal mode. In GLINT the GID planes, if present, are 4 bits deepallowing 16 possible Graphic ID's. The current GID is established bysetting the Window register.

If the unit is disabled fragments pass through undisturbed.

Stencil Test Unit

The stencil test conditionally rejects fragments based on the outcome ofa comparison between the value in the stencil buffer and a referencevalue. The stencil buffer is updated according to the current stencilupdate mode which depends on the result of the stencil test and thedepth test.

Stencil Test

This test only occurs if all the preceding tests (bitmask, scissor,stipple, alpha, pixel ownership) have passed. The stencil test iscontrolled by the stencil function and the stencil operation. Thestencil function controls the test between the reference stencil valueand the value held in the stencil buffer. The stencil operation controlsthe updating of the stencil buffer, and is dependent on the result ofthe stencil and depth tests.

If the stencil test is enabled then the stencil buffer will be updateddepending on the outcome of both the stencil and the depth tests (if thedepth test is not enabled the depth result is set to pass).

In addition a comparison bit mask is supplied in the StencilDataregister. This is used to establish which bits of the source andreference value are used in the stencil function test. In addition itshould normally be set to exclude the top four bits when the stencilwidth has been set to 4 bits in the StencilMode register.

The source stencil value can be from a number of places as controlled bya field in the StencilMode register:

    ______________________________________                                        LBWriteData                                                                   Stencil  Use                                                                  ______________________________________                                        Test logic                                                                             This is the normal mode.                                             Stencil  This is used, for instance, in the OpenGL draw pixels                register function where the host supplies the stencil values in the                    Stencil register. This is used when a constant stencil                        value is needed, for example, when clearing the stencil                       buffer when fast clear planes are not available.                     LBSourceData:                                                                          This is used, for instance, in the OpenGL copy pixels                (stencil function when the stencil planes are to be copied to the             value read                                                                             destination. The source is offset from the destination by            from the the value in LBSourceOffset regisier.                                localbuffer)                                                                  Source stencil                                                                         This is used, for instance, in the OpenGL copy pixels                value read                                                                             function when the stencil planes in the destination are not          from the to be updated: The stencil data will come either from the            localbuffer                                                                            localbuffer date, or the FCStencil register, depending on                     whether fast clear operations are enabled.                           ______________________________________                                    

Depth Test Unit

The depth (Z) test, if enabled, compares a fragment's depth against thecorresponding depth in the depth buffer. The result of the depth testcan effect the updating of the stencil buffer if stencil testing isenabled. This test is only performed if all the preceding tests(bitmask, scissor, stipple, alpha, pixel ownership, stencil) havepassed. The source value can be obtained from a number of places ascontrolled by a field in the DepthMode register:

    ______________________________________                                        Source   Use                                                                  ______________________________________                                        DDA (see This is used for normal Depth buffered 3D rendering.                 below)                                                                        Depth register                                                                         This is used, for instance, in the OpenGL draw pixels                         function where the host supplies the depth values through                     the Depth register.                                                           Alternatively this is used when a constant depth value is                     needed, for example, when clearing the depth buffer                           (when fast clear planes are not available) or 2D rendering                    where the depth is held constant.                                    LBSourceData:                                                                          This is used, for instance, in the OpenGL copy pixels                Source depth                                                                           function when the depth planes are to be copied to the               value from the                                                                         destination.                                                         localbuffer                                                                   Source Depth                                                                           This is used, for instance, in the OpenGL copy pixels                         function when the depth planes in the destination are not                     updated. The depth data will come either from the                             localbuffer or the FCDepth register depending the state                       of the Fast Clear modes in operation.                                ______________________________________                                    

When using the depth DDA for normal depth buffered rendering operationsthe depth values required are similar to those required for the colorvalues in the color DDA unit:

ZStart=Start Z Value

dZdYDom=Increment along dominant edge.

dZdX=Increment along the scan line.

The dZdX value is not required for Z-buffered lines.

The depth unit must be enabled to update the depth buffer. If it isdisabled then the depth buffer will only be updated if ForceLBUpdate isset in the Window register.

Framebuffer Read/Write Unit

Before rendering can take place GLINT must be configured to perform thecorrect framebuffer read and write operations. Framebuffer read andwrite modes effect the operation of alpha blending, logic ops, writemasks, image upload/download operations and the updating of pixels inthe framebuffer.

Framebuffer Read

The FBReadMode register allows GLINT to be configured to make 0, 1 or 2reads of the framebuffer. The following are the most common modes ofaccess to the framebuffer: Note that avoiding unnecessary additionalreads will enhance performance.

Rendering operations with no logical operations, software write-maskingor alpha blending. In this case no read of the framebuffer is requiredand framebuffer writes should be enabled.

Rendering operations which use logical ops, software write masks oralpha blending. In these cases the destination pixel must be read fromthe framebuffer and framebuffer writes must be enabled.

Image copy operations. Here setup varies depending on whether hardwareor software write masks are used. For software write masks, theframebuffer needs two reads, one for the source and one for thedestination. When hardware write masks are used (or when the softwarewrite mask allows updating of all bits in a pixel) then only one read isrequired.

Image upload. This requires reading of the destination framebuffer readsto be enabled and framebuffer writes to be disabled.

Image download. In this case no framebuffer read is required (as long assoftware writemasking and logic ops are disabled) and the write must beenabled.

For both the read and the write operations, an offset is added to thecalculated address. The source offset (FBSourceOffset) is used for copyoperations. The pixel offset (FBPixelOffset) can be used to allowmulti-buffer updates. The offsets should be set to zero for normalrendering.

The data read from the framebuffer may be tagged either FBDefault (datawhich may be written back into the framebuffer or used in some manner tomodify the fragment color) or FBColor (data which will be uploaded tothe host). The table below summarizes the framebuffer read/write controlfor common rendering operations:

    ______________________________________                                        Read-  ReadDes-          Read Data                                            Source tination Writes   Type   Rendering Operation.                          ______________________________________                                        Disabled                                                                             Disabled Enabled  --     Rendering with no                                                             logical operations,                                                           software write                                                                masks or blending.                            Disabled                                                                             Disabled Enabled  --     Image download.                               Disabled                                                                             Enabled  Disabled FBColor                                                                              Image upload.                                 Enabled                                                                              Disabled Enabled  FBDefault                                                                            Image copy with                                                               hardware write masks                          Disabled                                                                             Enabled  Enabled  FBDefault                                                                            Rendering using logical                                                       operations, software                                                          write masks or blending.                      Enabled                                                                              Enabled  Enabled  FBDefault                                                                            Image copy with                                                               software writemasks.                          ______________________________________                                    

Framebuffer Write

Framebuffer writes must be enabled to allow the framebuffer to beupdated. A single 1 bit flag controls this operation.

The framebuffer write unit is also used to control the operation of fastblock fills, if supported by the framebuffer. Fast fill rendering isenabled via the FastFillEnable bit in the Render command register, theframebuffer fast block size must be configured to the same value as theFastFillIncrement in the Render command register. The FBBlockColorregister holds the data written to the framebuffer during a block filloperation and should be formatted to the `raw` framebuffer format. Whenusing the framebuffer in 8 bit packed mode the data should be replicatedinto each byte. When using the framebuffer in packed 16 bit mode thedata should be replicated into the top 16 bits.

When uploading images the UpLoadData bit can be set to allow colorformatting (which takes place in the Alpha Blend unit).

It should be noted that the block write capability provided by the chipof the presently preferred embodiment is itself believed to be novel.According to this new approach, a graphics system can do masked blockwrites of variable length (e.g. 8, 16, or 32 pixels, in the presentlypreferred embodiment). The rasterizer defines the limits of the block tobe written, and hardware masking logic in the frame-buffer interfacepermits the block to be filled in, with a specified primitive, only upto the limits of the object being rendered. Thus the rasterizer can stepby the Block Fill increment. This permits the block-write capabilitiesof the VRAM chips to be used optimally, to minimize the length whichmust be written by separate writes per pixel.

Alpha Blend Unit

Alpha blending combines a fragment's color with those of thecorresponding pixel in the framebuffer. Blending is supported in RGBAmode only.

Alpha Blending

The alpha blend unit combines the fragment's color value with thatstored in the framebuffer, using the blend equation:

    C.sub.o =C.sub.s S+C.sub.d D

where: C_(o) is the output color; C_(s) is the source color (calculatedinternally); C_(d) is the destination color read from the framebuffer; Sis the source blending weight; and D is the destination blending weight.S and D are not limited to linear combinations; lookup functions can beused to implement other combining relations.

If the blend operations require any destination color components thenthe framebuffer read mode must be set appropriately.

Image Formatting

The alpha blend and color formatting units can be used to format imagedata into any of the supported GLINT framebuffer formats.

Consider the case where the framebuffer is in RGBA 4:4:4:4 mode, and anarea of the screen is to be uploaded and stored in an 8 bit RGB 3:3:2format. The sequence of operations is:

Set the rasterizer as appropriate

Enable framebuffer reads

Disable framebuffer writes and set the UpLoadData bit in the FBWriteModeregister

Enable the alpha blend unit with a blend function which passes thedestination value and ignores the source value (source blend Zero,destination blend One) and set the color mode to RGBA 4:4:4:4

Set the color formatting unit to format the color of incoming fragmentsto an 8 bit RGB 3:3:2 framebuffer format.

The upload now proceeds as normal. This technique can be used to uploaddata in any supported format.

The same technique can be used to download data which is in anysupported framebuffer format, in this case the rasterizer is set to syncwith FBColor, rather than Color. In this case framebuffer writes areenabled, and the UpLoadData bit cleared.

Color Formatting Unit

The color formatting unit converts from GLINT's internal colorrepresentation to a format suitable to be written into the framebuffer.This process may optionally include dithering of the color values forframebuffers with less than 8 bits width per color component. If theunit is disabled then the color is not modified in any way.

As noted above, the framebuffer may be configured to be RGBA or ColorIndex (CI).

Color Dithering

GLINT uses an ordered dither algorithm to implement color dithering.Several types of dithering can be selected.

If the color formatting unit is disabled, the color components RGBA arenot modified and will be truncated when placed in the framebuffer. In CImode the value is rounded to the nearest integer. In both cases theresult is clamped to a maximum value to prevent overflow.

In some situations only screen coordinates are available, but windowrelative dithering is required. This can be implemented by adding anoptional offset to the coordinates before indexing the dither tables.The offset is a two bit number which is supplied for each coordinate, Xand Y. The XOffset, YOffset fields in the DitherMode register controlthis operation, if window relative coordinates are used they should beset to zero.

Logical Op Unit

The logical op unit performs two functions; logic operations between thefragment color (source color) and a value from the framebuffer(destination color); and, optionally, control of a special GLINT modewhich allows high performance flat shaded rendering.

High Speed Flat Shaded Rendering

A special GLINT rendering mode is available which allows high speedrendering of unshaded images. To use the mode the following constraintsmust be satisfied:

Flat shaded aliased primitive

No dithering required

No logical ops

No stencil, depth or GID testing required

No alpha blending

The following are available:

Bit masking in the rasterizer

Area and line stippling

User and Screen Scissor test

If all the conditions are met then high speed rendering can be achievedby setting the FBWriteData register to hold the framebuffer data(formatted appropriately for the framebuffer in use) and setting theUseConstantFBWriteData bit in the LogicalOpMode register. All unusedunits should be disabled.

This mode is most useful for 2D applications or for clearing theframebuffer when the memory does not support block writes. Note thatFBWriteData register should be considered volatile when contextswitching.

Logical Operations

The logical operations supported by GLINT are:

    ______________________________________                                        Mode Name       Operation Mode Name     Operation                             ______________________________________                                        0    Clear      0         8    Nor      ˜(S .linevert split. D)         1    And        S & D     9    Equivalent                                                                             ˜(S   D)                        2    And Reverse                                                                              S & ˜D                                                                            10   Invert   ˜D                              3    Copy       S         11   Or Reverse                                                                             S .linevert split. ˜D           4    And Inverted                                                                             ˜S & D                                                                            12   Copy Invert                                                                            ˜S                              5    Noop       D         13   Or lnvert                                                                              ˜S .linevert split. D           6    Xor        S   D     14   Nand     ˜(S & D)                        7    Or         S .linevert split. D                                                                    15   Set      1                                     ______________________________________                                    

Where:

S=Source (fragment) Color, D=Destination (framebuffer) Color.

For correct operation of this unit in a mode which takes the destinationcolor, GLINT must be configured to allow reads from the framebufferusing the FBReadMode register.

GLINT makes no distinction between RGBA and CI modes when performinglogical operations. However, logical operations are generally only usedin CI mode.

Framebuffer Write Masks

Two types of framebuffer write masking are supported by GLINT, softwareand hardware. Software write masking requires a read from theframebuffer to combine the fragment color with the framebuffer color,before checking the bits in the mask to see which planes are writeable.Hardware write masking is implemented using VRAM write masks and noframebuffer read is required.

Software Write Masks

Software write masking is controlled by the FBSoftwareWriteMaskregister. The data field has one bit per framebuffer bit which when set,allows the corresponding framebuffer bit to be updated. When reset itdisables writing to that bit. Software write masking is applied to allfragments and is not controlled by an enable/disable bit. However it mayeffectively be disabled by setting the mask to all 1's . Note that theReadDestination bit must be enabled in the FBReadMode register whenusing software write masks, in which some of the bits are zero.

Hardware Write Masks

Hardware write masks, if available, are controlled using theFBHardwareWriteMask register. If the framebuffer supports hardware writemasks, and they are to be used, then software write masking should bedisabled (by setting all the bits in the FBSoftwareWriteMask register).This will result in fewer framebuffer reads when no logical operationsor alpha blending is needed.

If the framebuffer is used in 8 bit packed mode, then an 8 bit hardwarewrite mask must be replicated to all 4 bytes of the FBHardwareWriteMaskregister. If the framebuffer is in 16 bit packed mode then the 16 bithardware write mask must be replicated to both halves of theFBHardwareWriteMask register.

Host Out Unit

Host Out Unit controls which registers are available at the output FIFO,gathering statistics about the rendering operations (picking and extenttesting) and the synchronization of GLINT via the Sync register. Thesethree functions are as follows:

Message filtering. This unit is the last unit in the core so any messagenot consumed by a preceding unit will end up here. These messages willfall in to three classifications: Rasterizer messages which are neverconsumed by the earlier units, messages associated with image uploads,and finally programmer mistakes where an invalid message was written tothe input FIFO. Synchronization messages are a special category and aredealt with later. Any messages not filtered out are passed on the outputFIFO.

Statistic Collection. Here the active step messages are used to recordthe extent of the rectangular region where rasterization has beenoccurring, or if rasterization has occurred inside a specificrectangular region. These facilities are useful for picking and debugactivities.

Synchronization. It is often useful for the controlling software to findout when some rendering activity has finished, to allow the timelyswapping or sharing of buffers, reading back of state, etc. To achievethis the software would send a Sync message and when this reached thisunit any preceding messages or their actions are guaranteed to havefinished. On receiving the Sync message it is entered into the FIFO andoptionally generates an interrupt.

Sample Board-Level Embodiment

A sample board incorporating the GLINT chip may include simply:

the GLINT chip itself, which incorporates a PCI interface;

Video RAM (VRAM), to which the chip has read-write access through itsframe buffer (FB) port;

DRAM, which provides a local buffer then made for such purposes as Zbuffering; and

a RAMDAC, which provides analog color values in accordance with thecolor values read out from the VRAM.

Thus one of the advantages of the chip of the presently preferredembodiment is that a minimal board implementation is a trivial task.

FIG. 3A shows a sample graphics board which incorporates the chip ofFIG. 2B.

FIG. 3B shows another sample graphics board implementation, whichdiffers from the board of FIG. 3A in that more memory and an additionalcomponent is used to achieve higher performance.

FIG. 3C shows another graphics board, in which the chip of FIG. 2Bshares access to a common frame store with GUI accelerator chip.

FIG. 3D shows another graphics board, in which the chip of FIG. 2Bshares access to a common frame store with a video coprocessor (whichmay be used for video capture and playback functions (e.g. framegrabbing).

Alternative Board Embodiment with Additional Video Processor

In the presently preferred embodiment, the frame buffer interface of theGLINT chip contains additional simple interface logic, so that two chipscan both access the same frame buffer memory. This permits the GLINTchip to be combined with an additional chip for management to thegraphics produced by the graphical user interface. This provides amigration path for users and applications who need to take advantage ofthe existing software investment and device drivers for various othergraphics chips.

FIG. 3C shows another graphics board, in which the chip of FIG. 2Ashares access to a common frame store with a GUI accelerator chip (suchas an S3 chip). This provides a path for software migration, and alsoprovides a way to separate 3D rendering tasks from 2D rendering.

In this embodiment, a shared framebuffer is used to enable multipledevices to read or write data to the same physical framebuffer memory.Example applications using the GLINT 300SX:

Using a video device as a coprocessor to GLINT, to grab live video intothe framebuffer, for displaying video in a window or acquiring a videosequence;

Using GLINT as a 3D coprocessor to a 2D GUI accelerator, preserving anexisting investment in 2D driver software.

In a coprocessor system, the framebuffer is a shared resource, and soaccess to the resource needs to be arbitrated. There are also otheraspects of sharing a framebuffer that need to be considered:

Memory refreshing;

Transfer of data from the memory cells into the shift registers of theVRAM;

Control of writemasks and color registers.

GLINT uses the S3 Shared Frame Buffer Interface (SFBI) to share aframebuffer. This interface is able to handle all of the above aspectsfor two devices sharing a frame buffer, with the GLINT acting as anarbitration master or slave.

Timing Considerations in Shared Frame-Buffer Interface

The Control Signals used in the Shared Framebuffer interface, in thepresently preferred embodiment, are as follows:

GLINT as Primary Controller

FBReqN is internally re-synchronized to System Clock.

FBSelOEN remains negated.

FBGntN is asserted an unspecified amount of time after FBReqN isasserted.--Framebuffer Address, Data and Control lines are tri-stated byGLINT (the control lines should be held high by external pull-upresistors). The secondary controller is now free to drive theFramebuffer lines and access the memory.

FBGntN remains asserted until GLINT requires a framebuffer access, or arefresh or transfer cycle.

FBReqN must remain asserted while FBGntN is asserted.

When FBGntN is removed, the secondary controller must relinquish theaddress, data and control bus in a graceful manner--i.e. RAS, CAS, WEand OE must all be driven high before being tri-stated.

The secondary controller must relinquish the bus and negate FBReqNwithin 500 ns of FBGntN being negated.

Once FBReqN has been negated, it must remain inactive for at least 2system clocks (40 ns at 50 MHz).

GLINT as a Secondary Controller

Framebuffer Refresh and VRAM transfer cycles by GLINT are turned offwhen GLINT is a secondary framebuffer controller.

GLINT asserts FBReqN whenever is requires a framebuffer access.

FBGntN is internally re-synchronized to system clock.

When FBGntN is asserted, GLINT drives FBselOEN to enable any externalbuffers used to drive the control signals, and then drives theframebuffer address, data and control lines to perform the memoryaccess. FBReqN remains asserted while FBGntN is asserted.

When FBGntN is negated, GLINT finishes any outstanding memory cycles,drives the control lines inactive, negates FBselOEN and then tri-statesthe address, data and control lines, then releases FBReqN. GLINTguarantees to release FBReqN within 500 ns of FBGntN being negated.

GLINT will not reassert FBReqN within 4 system clock cycles (80 ns @ 50MHz).

Considerations for Board-Level Implementations

The following are some points to be noted when implementing a sharedframebuffer design with a GLINT 300SX:

Some 2D GUI Accelerators such as the S3 Vision964, and GLINT useconfiguration resistors on the framebuffer databus at reset. In thiscase care should be taken with the configuration setup where it effectsread only registers inside either device. If conflicts exist that cannot be resolved by the board initialization software, then the conflictsshould be resolved by isolating the two devices from each other at resetso they can read the correct configuration information. This isolationneed only be done for the framebuffer databus lines that cause problems;

GLINT should be configured as the secondary controller when used with anS3 GUI accelerator, as the S3 devices can only be primary controllers;

GLINT cannot be used on the daughter card interface as described in theS3 documentation, because this gives no access to the PCI bus. Asuitable PCI bridge should be used in a design with a PCI 2D GUIaccelerator and GLINT so they can both have access to the PCI bus;

The use of ribbon cable to carry the framebuffer signals between two PCIboards is not recommended, because of noise problems and the extrabuffering required would impact performance;

The GLINT 300SX does not provide a way of sharing its localbuffer.

In addition to the above capabilities of the 300SX, the 400TX alsoallows grabbing of live video into the localbuffer and real-time texturemapping of that video into the framebuffer for video manipulationeffects.

Alternative Board Embodiments with Multiple Rendering Accelerator Chips

This technical note describes some system design issues on how multipleGLINT devices can be used in parallel to achieve higher performance. Themain driving force for higher performance is the simulation marketwhich, at the low end, demands somewhere between 25-30M texture mappedpixels per second.

There are some key points before we look at different parallelorganizations:

To gain any benefit from running multiple GLINTs in parallel, theoverall system must be rendering bound. If the system is host bound orgeometry bound, then adding in more GLINTs will not improve the systemsperformance.

The memory systems (i.e. local buffer and framebuffer) are duplicatedfor each GLINT. Recall that the texture maps are stored in the localbuffer. A single GLINT places very high demands on the memory systems,and it would be very difficult to share them between multiple GLINTs. Inthe presently preferred embodiment there are no provisions for sharingthe local buffer, so if this is necessary it would have to be donebehind GLINT's back and transparently. The framebuffer can be shared(since GLINT has a SFB interface), but this is likely to be a bottleneck if shared between GLINTs.

Broadcast. In some parallel systems each GLINT will get the same (ormostly the same) primitive data and just render those pixels assigned toit. It is very desirable that this data is written by the host onlyonce, or fetched from the host address space once if DMA is being used.This presents two issues: Firstly the PCI bus does not have any conceptof broadcasting to multiple devices, and secondly GLINT does not have adedicated FIFO status signal pin an external controller can use. Neitherof these issues are insurmountable, but will require hardware to solve.However, if the application only uses a `few` large texture mappedprimitives so repeatedly sending or fetching the parameters for eachGLINT will not be a problem.

To avoid problems with Antialiasing, Bitmasks for characters, or Linestipple, the area stipple table can be used to reserve scanlines to aprocessor.

Parallel Configurations

This section looks at some of the common ways of applying parallelism tothe rendering operation. The list is not exhaustive and an interestedreader is directed to the book by Whitman cited above. No one paradigmis best and the choice is very application or market dependent.

Frame Interleaving

Frame Interleaving is where a GLINT works on frame n, the next GLINTworks on frame n+1, etc.. Each GLINT does everything for its own frameand the video is sourced from each GLINT's framebuffer in turn. Thisparadigm is perhaps the simplest one with very little hardware overheadand none of the above complications regarding antialiasing, blockcopies, bitmasks and line stipples.

This scheme only works when the image is double buffered (normal forsimulation systems) and where the increase in transport delay isacceptable. Transport delay is the time it takes for a user to see avisual change after new input stimulus to the system has occurred. With4 GLINTs this will be 4 frame times attributable to the renderingsystem, plus whatever else the whole system adds.

The cost of this method is also one of the highest, as ALL the memoryhas to be duplicated. By contrast, the schemes where the screen isdivided up can save depth and color buffer memory (but not texturememory).

Sequential frames will usually have very similar amounts of rendering,unless there is a discontinuity in the viewing position and/ororientation, so load balancing is generally good.

Frame Merging or Primitive Parallelism

Frame merging is a similar technique to frame interleaving where eachGLINT has a full local buffer and framebuffer. In this case theprimitives are distributed amongst the GLINTs and the resultant partialimages composited using the depth information to control which fragmentfrom the multiple buffers is displayed in each pixel position.

GLINT has not been designed to share the local buffer (where the depthinformation is held) so the compositing is not readily supported. Alsothe composition frequently needs to be done at video rate so requiressome fast hardware.

Alpha blending and Antialiasing presents some problems but the bitmask,block copies and line stipple are easily accommodated. Good loadbalancing depends on even distribution of primitives. Not all primitiveswill take the same amount of time to process so a round robindistribution scheme, or a heuristic one with takes into account theexpected processing time for each primitive will be needed.

Screen Subdivision--Blocks

Here the screen is divided up into large contiguous regions and a GLINTlooks after each region. Primitives which overlap between regions aresent to both regions and scissor clipping used. Primitives containedwholly in one region are ideally just sent to the one GLINT.

The number of regions and the horizontal and/or vertical division of thescreen can be chosen as appropriate, but horizontal bands are usuallyeasier for the video hardware to cope with. Each GLINT only needs enoughlocal buffer and frame buffer to cover the pixels in its own region, buttexture maps are duplicated in full. Block copies are a problem when theblock, or part block is moved between regions. Bit masking and linestipples can be solved with some careful clipping.

Load balancing is very poor in this paradigm, since most of the scenecomplexity can be concentrated into one region. Dynamically changing thesize of the regions based on expected scene complexity (maybe measuredfrom the previous frame) can alleviate the poor load balancing to someextent.

Screen Subdivision--Interleaved Scanlines

The interleave factor is every other n^(th) scanline where n is thenumber of GLINTs. Vertical interleaves are possible, but not supportedby the GLINT rasterizer. Nearly all primitives will overlap multiplescanlines so are ideally broadcast to all GLINTs. Each GLINT will havedifferent start values for the rasterization and interpolationparameters.

Each GLINT only needs enough local buffer and frame buffer to cover thepixels in its own region, but texture maps are duplicated in full.

Some block copies are a problem when the block is moved between nonn^(th) scanlines, but horizontal moves are available with any alignment.Bit masking can be solved with some careful clipping, but line stippleshave no easy solution. Antialiasing is not normally a problem but withGLINT 300SX there is no provision for sub scanline steps as well asn^(th) scanline steps. Load balancing is excellent in this paradigmwhich is the main reason it features prominently in the literature.

Thus the simplest and lowest risk method of using multiple GLINTs isFrame Interleaving, but if this is not an option, e.g. because of thetransport delay or the amount of memory needed, then the next bestchoice is the Interleaved Scanline.

Suspend and swap on frame blanking

In a high frame rate animation system the time waiting for frameblanking (before switching displayed frames over and proceeding with anew frame's worth of drawing) can be a very high percentage of the timeeach frame takes to process.

The SuspendUntilFrameBlank message solves this problem by allowing allnon framebuffer rendering to proceed while waiting for a frame blank tooccur. If, while waiting for a frame blank to occur, any writes to theframebuffer are attempted the core will stall (by virtue of the addressFIFOs backing up) until the frame blank occurs. This happensautomatically without any host involvement so now the host software canignore having to synchronize with frame blank before issuing anyrendering commands.

The contents of the data field in the SuspendUntilFrameBlank message isused to indicate where and how the new display frame is to be found andis passed to the FBIU with no interpretation by the FB Write Unit.

Framebuffer Write Unit

Description

The Framebuffer Write Unit controls write requests to the Framebuffermemory. More details regarding the interface to the FramebufferInterface Unit can be found in the previous section on the FramebufferRead/Write Unit. This unit responds to the following messages:

On receiving a FBWriteData message the data is stored locally untilneeded.

On receiving an Active Step message the write enable bit is checked. Ifit is set then the FBWriteData is passed to Write data FIFO in theFramebuffer Interface Unit and a write request is issued. The addressfor this write is already queued up in the Framebuffer Interface Unit.If writes are disabled then the pending write operation is cancelled sothe write address stored in the Framebuffer Interface Unit is discarded.

In this unit all writing is controlled by the ActiveStep messages. Whenwriting constant color data to the framebuffer (i.e. no dither orlogical ops) the color information can be sent by the host in anFBWriteData message and this will lodge in this unit. Each subsequentActiveStep message will initiate a write with an overall cost of onemessage per write, which matches the framebuffers peak bandwidth.

On receiving a FBCancelWrite message a flag is set so that on the nextActiveStep message the outstanding write in the Framebuffer InterfaceUnit is cancelled rather than executed.

On receiving a PrepareToRender or ResumeReads message the FramebufferInterface Unit is notified that it can, after all queued writes arecomplete, resume doing reads. See the previous section on theFramebuffer Read/Write Unit for detail on what this is used for. Therasterization mode (normal, span fill constant color, or span fillvariable color) are also noted.

On receiving a Sync or WaitForCompletion message this unit waits for alloutstanding data in the Framebuffer Interface Unit to have been`written`, as shown by the FBWrComplete signal being asserted. If theSync message occurred then the Sync message is forwarded onto the nextunit. This ensures that all the work associated with a primitive hasbeen completed before the host is informed.

If the WaitForCompletion message occurred this is consumed and theRasteriser Unit informed that it is safe to continue using a dedicatedsignal line.

On receiving a SpanMask message span mask processing occurs.

The FBBlockColour and FBHardwareWriteMask messages both forward theirdata field to the write data FIFO in the Framebuffer Write Unit with theappropriate write mode. The data is also held locally for readback. Notethat this data in the write data FIFO have no corresponding addresses inthe Wa FIFO.

The SuspendUntilFrameBlank message is forwarded onto the FramebufferInterface Unit, where it prevents any further memory writes (normal orspan writes) until after the next the Vertical Frame Blank has happened.When frame blank occurs new writes are allowed to proceed and thebuffers are swapped over so the video is displayed from the alternatebuffer. The method of doing the buffer swap (full screen or color space)is identified in the data field of this message. By using this messagethe host does not need to get involved with waiting for vertical frameblank itself before it can issue new messages to GLINT. While waitingfor frame blank any messages or actions which do not involve writing tothe framebuffer (such as clearing down the depth buffer) can proceed.Attempting to write to the framebuffer while waiting for frame blankwill just result in the Write Data FIFO blocking for the duration andthis will ripple back through the chip.

The FBWriteMode message data format is controlled by modifying bits 0and 3 of the 32 bit message as follows:

Bit 0=0: Writes disabled

Bit 0=1: Writes enabled

Bit 3=0: UpLoadData disabled

Bit 3=1: UpLoadData enabled

The UpLoadData bit, when set, causes the FBWriteData associated witheach step of SpanMask message to be forwarded onto the next unit in aFBColour message. This feature allows data read from the framebuffer tobe formatted (using the formatting logic in the Alpha Blend and Ditherunits) into the desired output format before being uploaded.

Among the disclosed classes of preferred embodiments, there is provided:A method for controlling a framebuffer memory having a first bufferportion and a second buffer portion comprising the steps of: receivingdata into a framebuffer unit from a data bus, said data comprisinginstruction bits and data bits; if the instruction bits correspond to aread command then reading from a location in said first buffer portionindicated by said data bits and placing the contents of said location onsaid data bus; if the instruction bits correspond to a write commandthen writing a portion of said data bits to a location in said firstbuffer portion indicted by said data bits; if the instruction bitscorrespond to a suspend-until-frame-blank command, then suspending allwrite operations on said first buffer portion until a frame-blankcommand is received; when a frame-blank command is received, thendisplaying data from said first buffer portion and reenabling all writeoperations on said first buffer portion.

Among the disclosed classes of preferred embodiments, there is alsoprovided: A memory control system comprising: a frame buffer memoryhaving a first buffer portion and a second buffer portion; a controllogic connected to receive and communicate a control signal comprisinginstruction and data segments; a read circuit connected between saidcontrol logic and said memory capable of reading from specific addressesspecified by said control logic and returning the contents of saidaddresses to said control logic; a write circuit connected between saidcontrol logic and said memory capable of writing to or clearing specificaddresses or groups of addresses in said memory according to saidcontrol logic; a suspend circuit connected to disable said write circuitwhen a suspend-until-frame-blank command is received by said controllogic; wherein said control logic is connected to said write circuit toclear a specific said buffer portion and re-enable said write circuitwhen a frame-blank command is received.

Among the disclosed classes of preferred embodiments, there is alsoprovided: A pipelined graphics system comprising: a data bus; arendering circuit connected to said data bus. a frame buffer memoryhaving a first buffer portion and a second buffer portion; a controllogic connected to said data bus to receive and communicate a controlsignal comprising instruction and data segments; a read circuitconnected between said data bus and said memory capable of reading fromspecific addresses specified by said control logic and returning thecontents of said addresses to said control logic; a write circuitconnected between said data bus and said memory capable of writing to orclearing specific addresses or groups of addresses in said memoryaccording to said control logic; a suspend circuit connected to disablesaid write circuit when a suspend-until-frame-blank command is receivedby said control logic; and a display circuit for displaying some portionof the contents of said memory; wherein when said write circuit isdisabled, all other circuits continue to operate; wherein said controllogic is connected to said write circuit to re-enable said write circuitwhen a frame-blank command is received.

Among the disclosed classes of preferred embodiments, there is alsoprovided: A graphics processing subsystem, comprising: an input buffer;a rasterizer, connected to read messages from said input buffer and togenerate a sequence of pixel locations accordingly; one or moredifferential data analyzers, operatively connected to receive messagesfrom said rasterizer, and connected to provide a sequence ofincrementally changing parameter values for sequences of pixel locationsdefined by messages received from said rasterizer; a plurality ofadditional processing units, operatively connected in series in apipeline relationship, and jointly operatively connected to receivemessages from said differential data analyzers; plural ones of saidadditional processing units each having customized hardware which isdifferent from one another and from said color differential dataanalyzers; said processing units being mutually interconnected in apipeline relationship, such that individual ones of said processingunits receive messages and, in accordance with the content of each saidrespective message, programmably perform a respective graphicsprocessing operation, and selectably transmit said respective message toa succeeding one of said processing units; at least one framebuffermemory connected to at least one of said processing unit; a suspendcircuit connected to disable write access to said memory when asuspend-until-frame-blank command is received; and wherein said controllogic is connected to said write circuit to re-enable write access tosaid memory when a frame-blank command is received; and whereby saidplural processing units jointly provide a pipelinedmultiple-instruction-multiple-device (MIMD) graphics processingarchitecture.

Modifications and Variations

As will be recognized by those skilled in the art, the innovativeconcepts described in the present application can be modified and variedover a tremendous range of applications, and accordingly the scope ofpatented subject matter is not limited by any of the specific exemplaryteachings given.

The foregoing text has indicated a large number of alternativeimplementations, particularly at the higher levels, but these are merelya few examples of the huge range of possible variations.

For example, the preferred chip context can be combined with otherfunctions, or distributed among other chips, as will be apparent tothose of ordinary skill in the art.

For another example, the described graphics systems and subsystems canbe used, in various adaptations, not only in high-end PC's, but also inworkstations, arcade games, and high-end simulators.

For another example, the described graphics systems and subsystems arenot necessarily limited to color displays, but can be used withmonochrome systems.

For another example, the described graphics systems and subsystems arenot necessarily limited to displays, but also can be used in printerdrivers.

What is claimed is:
 1. A method for controlling a framebuffer memoryhaving a first buffer portion and a second buffer portion comprising thesteps of:receiving data into a framebuffer unit from a data bus, saiddata comprising instruction bits and data bits; if the instruction bitscorrespond to a read command then reading from a location in said firstbuffer portion indicated by said data bits and placing the contents ofsaid location on said data bus; if the instruction bits correspond to awrite command then writing a portion of said data bits to a location insaid first buffer portion indicted by said data bits; if the instructionbits correspond to a suspend-until-frame-blank command, then suspendingall write operations on said first buffer portion until a frame-blankcommand is received; when a frame-blank command is received, thendisplaying data from said first buffer portion and re-enabling all writeoperations on said first buffer portion.
 2. The method of claim 1,wherein all read operations are suspended when said write operations aresuspended.
 3. The method of claim 1, wherein said first and secondbuffer portions comprise distinct address ranges of said memory.
 4. Themethod of claim 1, wherein write accesses to said second buffer portionsare suspended when said write operations to said first buffer portionare suspended.
 5. The method of claim 1, wherein said contents of saidfirst buffer portion are cleared before said write operations arere-enabled.
 6. The method of claim 1, wherein said each correspondinglocation in said first and second buffer portions comprise first andsecond pixel halves respectively.
 7. The method of claim 1, wherein saidmemory further comprises a local buffer, said local buffer beingoperated independently of said first and second buffer portions.
 8. Themethod of claim 1, wherein said memory comprises VRAM.
 9. The method ofclaim 1, wherein said data is displayed from said second buffer portionwhen said first buffer portion is being written.
 10. A memory controlsystem comprising:a frame buffer memory having a first buffer portionand a second buffer portion; a control logic connected to receive andcommunicate a control signal comprising instruction and data segments; aread circuit connected between said control logic and said memory forreading from specific addresses specified by said control logic andreturning the contents of said addresses to said control logic; a writecircuit connected between said control logic and said memory for writingto or clearing specific addresses or groups of addresses in said memoryaccording to said control logic; a suspend circuit connected to disablesaid write circuit when a suspend-until-frame-blank command is receivedby said control logic; wherein said control logic is connected to saidwrite circuit to clear a specific said buffer portion and re-enable saidwrite circuit when a frame-blank command is received.
 11. The system ofclaim 10, wherein said first and second buffer portions comprisedistinct address ranges of said memory.
 12. The system of claim 10,wherein said each corresponding location in said first and second bufferportions comprise first and second pixel halves respectively.
 13. Thesystem of claim 10, wherein said memory further comprises a localbuffer, said local buffer being operated independently of said first andsecond buffer portions.
 14. The system of claim 10, wherein said memorycomprises VRAM.
 15. The system of claim 10, wherein said data isdisplayed from said second buffer portion when said first buffer portionis being written.
 16. A pipelined graphics system comprising:a data bus;a rendering circuit connected to said data bus; a frame buffer memoryhaving a first buffer portion and a second buffer portion; a controllogic connected to said data bus to receive and communicate a controlsignal comprising instruction and data segments; a read circuitconnected between said data bus and said memory for reading fromspecific addresses specified by said control logic and returning thecontents of said addresses to said control logic; a write circuitconnected between said data bus and said memory for writing to orclearing specific addresses or groups of addresses in said memoryaccording to said control logic; a suspend circuit connected to disablesaid write circuit when a suspend-until-frame-blank command is receivedby said control logic; and a display circuit for displaying some portionof the contents of said memory; wherein when said write circuit isdisabled, all other circuits continue to operate; wherein said controllogic is connected to said write circuit to re-enable said write circuitwhen a frame-blank command is received.
 17. The system of claim 16,wherein said frame-blank command is generated by said display circuitwhen it is ready to display a new set of data.
 18. The system of claim16, wherein said read circuit is connected to be disabled when saidwrite circuit is disabled.
 19. The system of claim 16, wherein when saidframe-blank command is received, a specific said buffer portion iscleared before said write circuit is re-enabled.
 20. The system of claim16, wherein said read circuit is suspended when said write circuit issuspended.
 21. The system of claim 16, wherein when said write circuitis suspended, said rendering circuit is also suspended.
 22. A graphicsprocessing subsystem, comprising:an input buffer; a rasterizer,connected to read messages from said input buffer and to generate asequence of pixel locations accordingly; one or more differential dataanalyzers, operatively connected to receive messages from saidrasterizer, and connected to provide a sequence of incrementallychanging parameter values for sequences of pixel locations defined bymessages received from said rasterizer; a plurality of additionalprocessing units, operatively connected in series in a pipelinerelationship, and jointly operatively connected to receive messages fromsaid differential data analyzers; plural ones of said additionalprocessing units each having customized hardware which is different fromone another and from said differential data analyzers; said processingunits being mutually interconnected in a pipeline relationship, suchthat individual ones of said processing units receive messages and, inaccordance with the content of each said respective message,programmably perform a respective graphics processing operation, andselectably transmit said respective message to a succeeding one of saidprocessing units; at least one framebuffer memory connected to at leastone of said processing unit; a control logic connected to disable writeaccess to said memory when a suspend-until-frame-blank command isreceived; and wherein a control logic is connected to a write circuit ofsaid memory to re-enable write access to said memory when a frame-blankcommand is received; and whereby said plural processing units jointlyprovide a pipelined multiple-instruction-multiple-device (MIMD) graphicsprocessing architecture.
 23. The graphics processing subsystem of claim22, wherein said parameter is a color value.
 24. The graphics processingsubsystem of claim 22, wherein said control logic is connected to saidwrite circuit to clear said memory when said frame-blank command isreceived and before re-enabling write access to said memory.
 25. Thegraphics processing subsystem of claim 22, wherein said parameter is adepth value.
 26. The graphics processing subsystem of claim 22, whereinsaid processing units include a texturing unit.
 27. The graphicsprocessing subsystem of claim 22, wherein said processing units includea memory access unit which reads and writes a local buffer memory. 28.The graphics processing subsystem of claim 22, wherein at least someones of said processing units include internally paralleled data paths.29. The graphics processing subsystem of claim 22, wherein saidrasterizer and said differential data analyzers and all of saidadditional processing units are integrated into a single integratedcircuit.
 30. The graphics processing subsystem of claim 22, wherein saidrasterizer generates step messages which are passed through all of saidprocessors.